home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2001 May / maximum-cd-2001-05.iso / Blade of Darkness / data1.cab / Program_Executable_Files / Maps / Ragnar_M2 / DefFuncs.py < prev    next >
Encoding:
Text File  |  2000-11-16  |  90.1 KB  |  2,556 lines

  1. import def_class
  2. import Bladex
  3. import EnemyTypes
  4. import ReadGSFile
  5. import Enm_Gen
  6. import B3DLib
  7. import Traps_C
  8. import GameText
  9. import AuxFuncs
  10. import Scorer
  11. import Sounds
  12. import EnmGenRnd
  13. import ReadGSFile
  14. import Actions
  15. import Reference
  16. import Sounds
  17. import stone
  18. import heavyObjects
  19. import Room
  20. import Button
  21. import GotoMapVars
  22. import ScriptSkip
  23. import AbreCam
  24. import MusicTool
  25. import NetSounds
  26.  
  27.  
  28.  
  29. #*************************************************************************************************
  30. #*************************************************************************************************
  31. #*************************************************************************************************
  32. #*******************************                                        **************************
  33. #*******************************   Definiciones para agua.py            **************************
  34. #*******************************                                        **************************
  35. #*************************************************************************************************
  36. #*************************************************************************************************
  37.  
  38.  
  39. def eSceneCam(sector,entity) :
  40.     if entity == "Player1":
  41.         scam.OnEnter = ""
  42.         darfuncs.LaunchMaxCamera("ragnar_verPatrulla.cam",0,-1)
  43.         Bladex.ExeMusicEvent(Bladex.GetMusicEvent("presentapatio"))
  44.         Bladex.AddScheduledFunc(Bladex.GetTime()+7.0, MusicTool.LaunchMusicEvent, ("emptyloquesea",))
  45.  
  46. def CreateCascada1(Cascada,p,d,v,pc,Time = 18,Grav = 8000,PPS = 400):
  47.     cascada=Bladex.CreateEntity(Cascada, "Entity Particle System D2",p[0],p[1],p[2])
  48.     cascada.D=d[0],d[1],d[2]
  49.     cascada.ParticleType="AguaC2"
  50.     cascada.Friction=0.07
  51.     cascada.RandomVelocity=10.0
  52.     cascada.Velocity=v[0],v[1],v[2]
  53.     cascada.PPS=PPS
  54.     cascada.YGravity=Grav
  55.     cascada.Time2Live=Time
  56.  
  57.     Espuma2=Bladex.CreateEntity(Cascada+"Espuma2", "Entity Particle System D2",pc[0],pc[1],pc[2])
  58.     Espuma2.D=d[0],d[1],d[2]
  59.     Espuma2.ParticleType="Espuma2"
  60.     Espuma2.PPS=40
  61.     Espuma2.YGravity=0.0
  62.     Espuma2.Friction=0.07
  63.     Espuma2.Velocity=0.0, -1000.0, 0.0
  64.     Espuma2.RandomVelocity=30.0
  65.     Espuma2.RandomVelocity_V=30.0
  66.     Espuma2.Time2Live=10
  67.  
  68. def CreateEspuma2(Espuma2,pc,d,PPS = 40):
  69.     Espuma2=Bladex.CreateEntity(Espuma2, "Entity Particle System D2",pc[0],pc[1],pc[2])
  70.     Espuma2.D=d[0],d[1],d[2]
  71.     Espuma2.ParticleType="Espuma2"
  72.     Espuma2.PPS=PPS
  73.     Espuma2.YGravity=0.0
  74.     Espuma2.Friction=0.07
  75.     Espuma2.Velocity=0.0, -1000.0, 0.0
  76.     Espuma2.RandomVelocity=30.0
  77.     Espuma2.RandomVelocity_V=30.0
  78.     Espuma2.Time2Live=10
  79.  
  80.  
  81. def BorrarCascada1(cascada):
  82.     cascada = Bladex.GetEntity(cascada)
  83.     cascada.SubscribeToList("Pin")
  84.     
  85.     Espuma2 = Bladex.GetEntity(cascada+"Espuma2")
  86.     Espuma2.SubscribeToList("Pin")
  87.  
  88. #*************************************************************************************************
  89. #*************************************************************************************************
  90. #*************************************************************************************************
  91. #*******************************                                        **************************
  92. #*******************************   Definiciones para enemigos.py        **************************
  93. #*******************************                                        **************************
  94. #*************************************************************************************************
  95. #*************************************************************************************************
  96.  
  97. def ApareceCosita(sectorindex,entityname):
  98.     if entityname == "Player1":
  99.         darfuncs.UnhideBadGuy("1cos")
  100.         darfuncs.UnhideBadGuy("2cos")
  101.         darfuncs.UnhideBadGuy("4cos")
  102.         sencos=Bladex.GetSector(-136750,15000,69550)
  103.         sencos.OnEnter=""
  104.  
  105. def ApareceCosita2(sectorindex,entityname):
  106.     if entityname == "Player1":
  107.         darfuncs.UnhideBadGuy("1cos1")
  108.         darfuncs.UnhideBadGuy("2cos2")
  109.         darfuncs.UnhideBadGuy("3cos3")
  110.         sencos2=Bladex.GetSector(-125000,8000,50000)
  111.         sencos2.OnEnter=""
  112.  
  113. def ApareceKOMkngt(sectorindex,entityname):
  114.     if entityname == "Player1":
  115.         darfuncs.UnhideBadGuy("KOMkngt")
  116.         senkom=Bladex.GetSector(-74000,-5000,51500)
  117.         senkom.OnEnter=""
  118.  
  119. def Muere_KT_Patio(entity):
  120.     global N_KT_Patio
  121.     
  122.     Bladex.GetEntity(entity).Data.DefImDeadFunc(entity)
  123.     
  124.     if N_KT_Patio == 1:
  125.         AbrePuertaTres()
  126.     else:
  127.         N_KT_Patio = N_KT_Patio - 1
  128.  
  129. def Aparece4kngt(sectorindex,entityname):
  130.     if entityname == "Player1":
  131. #        darfuncs.UnhideBadGuy("4kngt")
  132. #        darfuncs.UnhideBadGuy("5kngt")
  133.         darfuncs.UnhideBadGuy("5bkngt")
  134.         sen4kngt=Bladex.GetSector(-79000,-8000,70000)
  135.         sen4kngt.OnEnter=""
  136.  
  137. def Desaparecen1(sectorindex,entityname):
  138.     if entityname == "Player1":
  139.         darfuncs.HideBadGuy("1cos")
  140.         darfuncs.HideBadGuy("2cos")
  141.         darfuncs.HideBadGuy("4cos")
  142.         darfuncs.HideBadGuy("1cos1")
  143.         darfuncs.HideBadGuy("2cos2")
  144.         darfuncs.HideBadGuy("3cos3")
  145.         darfuncs.HideBadGuy("KOMkngt")
  146.         darfuncs.HideBadGuy("3kngt")
  147.         darfuncs.HideBadGuy("2kngt")
  148.         sendes1=Bladex.GetSector(-122552.583148, -6321.28490453, 48176.4895)
  149.         sendes1.OnEnter=""
  150.  
  151. def Aparece227kngt(sectorindex,entityname):
  152.     if entityname == "Player1":
  153.         darfuncs.UnhideBadGuy("227kngt")
  154.         sen227kngt=Bladex.GetSector(-135500,-5500,-93000)
  155.         sen227kngt.OnEnter=""
  156.  
  157. def Aparece228kngt(sectorindex,entityname):
  158.     if entityname == "Player1":
  159.         darfuncs.UnhideBadGuy("228kngt")
  160.         #darfuncs.UnhideBadGuy("229kngt")
  161.         sen228kngt=Bladex.GetSector(-127727.850637, -12613.5904283, -110488.57)
  162.         sen228kngt.OnEnter=""
  163.  
  164. #*************************************************************************************************
  165. #*************************************************************************************************
  166. #*************************************************************************************************
  167. #*******************************                                        **************************
  168. #*******************************   Definiciones para elevador.py        **************************
  169. #*******************************                                        **************************
  170. #*************************************************************************************************
  171. #*************************************************************************************************
  172.  
  173. def SubeElevador():
  174.  
  175.     global enmarcha
  176.     if enmarcha:
  177.         return
  178.  
  179.     desplazamientos=(500.0, 5850.0, 500.0)
  180.     vectores=((0.0, -1.0, 0.0), (0.0, -1.0, 0.0), (0.0, -1.0, 0.0))
  181.     vel_iniciales=(0.0, 2000.0, 2000.0)
  182.     vel_finales=(2000.0, 2000.0, 0.0)
  183.     son_iniciales=(golpeelevador, "", golpeelevador)
  184.     son_durante=(loopelevador, loopelevador, loopelevador)
  185.     Objects.NDisplaceObject(plataformaelevadormovil, desplazamientos, vectores, vel_iniciales, vel_finales, son_iniciales, son_durante)
  186.     columnaelevador.CloseDoor()
  187.     enmarcha=1
  188.  
  189. def BajaElevador():
  190.  
  191.     desplazamientos=(500.0, 5850.0, 500.0)
  192.     vectores=((0.0, 1.0, 0.0), (0.0, 1.0, 0.0), (0.0, 1.0, 0.0))
  193.     vel_iniciales=(0.0, 2000.0, 2000.0)
  194.     vel_finales=(2000.0, 2000.0, 0.0)
  195.     son_iniciales=(golpeelevador, "", golpeelevador)
  196.     son_durante=(loopelevador, loopelevador, loopelevador)
  197.     Objects.NDisplaceObject(plataformaelevadormovil, desplazamientos, vectores, vel_iniciales, vel_finales, son_iniciales, son_durante)
  198.     columnaelevador.OpenDoor()
  199.  
  200. def ElevadorArriba():
  201.  
  202.     global enmarcha
  203.     enmarcha=0
  204.  
  205.  
  206. def EsperaYBajaElevador():
  207.  
  208.     Bladex.AddScheduledFunc(Bladex.GetTime()+3.0, BajaElevador, ())
  209.  
  210.  
  211. def SubeElevador2():
  212.  
  213.     desplazamientos=(500.0, 6250.0, 500.0)
  214.     vectores=((0.0, -1.0, 0.0), (0.0, -1.0, 0.0), (0.0, -1.0, 0.0))
  215.     vel_iniciales=(0.0, 2000.0, 2000.0)
  216.     vel_finales=(2000.0, 2000.0, 0.0)
  217.     son_iniciales=(golpeelevador, "", golpeelevador)
  218.     son_durante=(loopelevador, loopelevador, loopelevador)
  219.     Objects.NDisplaceObject(plataformaelevador2movil, desplazamientos, vectores, vel_iniciales, vel_finales, son_iniciales, son_durante)
  220.     columnaelevador2.CloseDoor()
  221.  
  222.  
  223. def BajaElevador2():
  224.  
  225.     global enmarcha
  226.     if enmarcha:
  227.         return
  228.     desplazamientos=(500.0, 6250.0, 500.0)
  229.     vectores=((0.0, 1.0, 0.0), (0.0, 1.0, 0.0), (0.0, 1.0, 0.0))
  230.     vel_iniciales=(0.0, 2000.0, 2000.0)
  231.     vel_finales=(2000.0, 2000.0, 0.0)
  232.     son_iniciales=(golpeelevador, "", golpeelevador)
  233.     son_durante=(loopelevador, loopelevador, loopelevador)
  234.     Objects.NDisplaceObject(plataformaelevador2movil, desplazamientos, vectores, vel_iniciales, vel_finales, son_iniciales, son_durante)
  235.     columnaelevador2.OpenDoor()
  236.     enmarcha=1
  237.  
  238.  
  239. def EsperaYSubeElevador2():
  240.  
  241.     Bladex.AddScheduledFunc(Bladex.GetTime()+3.0, SubeElevador2, ())
  242.  
  243.  
  244. def Elevador2Arriba():
  245.  
  246.     global enmarcha
  247.     enmarcha=0
  248.  
  249.  
  250. #*************************************************************************************************
  251. #*************************************************************************************************
  252. #*************************************************************************************************
  253. #*******************************                                        **************************
  254. #*******************************   Definiciones para DrunkWarder.py     **************************
  255. #*******************************                                        **************************
  256. #*************************************************************************************************
  257. #*************************************************************************************************
  258.  
  259.  
  260. def IniciaCarcelero(sector_index, entity_name):
  261.     sectoriniccarc.OnEnter=""
  262.     carcelero.Data.Murmura("Carcelero")
  263.  
  264. def Herido(entity_name):
  265.     carcelero.Data.Molestia("Carcelero")
  266.  
  267. def Matado(entity_name):
  268.     carcelero.Data.Muere("Carcelero")
  269.  
  270. ############################
  271. #     Apagar ronquidos     #
  272. ############################
  273.  
  274. def ApagaRonquidos(sector_index, entity_name):
  275.     sectorapagaronq.OnEnter=""
  276.     rastmaz1.SubscribeToList("Pin")
  277.     rastmaz2.SubscribeToList("Pin")
  278.     rastmaz3.SubscribeToList("Pin")
  279.     if carcelero.Data.Muerto==0:
  280.         carcelero.Data.ronquidos.Stop()
  281.     if not prisionerovivo1.Data.Muerto:
  282.         darfuncs.HideBadGuy(prisionerovivo1.Name)
  283.     if not prisionerovivo2.Data.Muerto:
  284.         darfuncs.HideBadGuy(prisionerovivo2.Name)
  285.  
  286.  
  287.  
  288.  
  289. #*************************************************************************************************
  290. #*************************************************************************************************
  291. #*************************************************************************************************
  292. #*******************************                                        **************************
  293. #*******************************   Definiciones para ChaosKnight.py     **************************
  294. #*******************************                                        **************************
  295. #*************************************************************************************************
  296. #*************************************************************************************************
  297.  
  298.  
  299. ###############
  300. #   Eventos   #
  301. ###############
  302.  
  303. def ChaosDamage(VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  304.     chaos = Bladex.GetEntity(VictimName)
  305.     Damage.CalculateDamage(VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded)
  306.     if chaos.Life < 800:
  307.         chaos.ImDeadFunc(VictimName)
  308.         chaos.DamageFunc = ""
  309.  
  310.  
  311. ####################
  312. #     Acciones     #
  313. ####################
  314.  
  315. #####################
  316. #     Aparicion     #
  317. #####################
  318.  
  319. def ApareceChk():
  320.     Bladex.SetListenerPosition(2)
  321.     chaosk1.Data.Appear()
  322.  
  323. def ReiniciaCamaraChk(entity_name, camera_element, node):
  324.     cam=Bladex.GetEntity("Camera")
  325.     if (node==1) and (camera_element==1):
  326.         cam.TType=0
  327.         cam.CameraClearPath(1)
  328.     if (node==0) and (camera_element==0):
  329.         cam.SType=0
  330.         cam.CameraClearPath(0)
  331.         cam.SetPersonView("Player1")
  332.         cam.Cut()
  333.         Scorer.SetVisible(1)
  334.         cam.ChangeNodeFunc=""
  335.         ScriptSkip.SkipScriptEnd()
  336.         Bladex.SetListenerPosition(1)
  337.         chaosk1.Blind=0
  338.         chaosk1.Deaf=0
  339.  
  340. def DetieneCamaraChk(entity_name, camera_element, node):
  341.     global prevtpos
  342. #    print "nodo: "+`node`+"   elemento: "+`camera_element`
  343.     cam=Bladex.GetEntity("Camera")
  344.     if (node==1) and (camera_element==1):
  345.         cam.TType=0
  346.         cam.CameraClearPath(1)
  347.     if (node==9) and (camera_element==0):
  348.         # Path target
  349.         cam.AddCameraNode(1, 3.0, -114000.0, 0.0, -99500.0)
  350.         cam.AddCameraNode(1, 3.0, prevtpos[0], prevtpos[1], prevtpos[2])
  351.         cam.AddCameraNode(1, 3.0, -110000.0, 0.0, -96000.0)
  352.         cam.TType=1
  353.         cam.CameraStartPath(1)
  354.         cam.ChangeNodeFunc=ReiniciaCamaraChk
  355.  
  356. def MueveCamaraChk(sector_index, entity_name):
  357.     #Bladex.ExeMusicEvent(-1)
  358.     Bladex.KillMusic()
  359.     Bladex.ExeMusicEvent(Bladex.GetMusicEvent("chaosragnar"))
  360.     
  361.     global prevtpos
  362.     if entity_name=="Player1":
  363.         sectorcamarachk.OnEnter=""
  364.         ScriptSkip.SkipScriptStart("cacaos")
  365.         cam=Bladex.GetEntity("Camera")
  366.         opos=cam.Position
  367.         tpos=cam.TPos
  368.         prevtpos=cam.TPos
  369.         # Path objetivo
  370.         cam.AddCameraNode(0, 2.00, opos[0], opos[1], opos[2])
  371.         cam.SetCameraStartTangentNode(0, 0, 687.5, 0.0, -1125.0)
  372.         cam.SetCameraEndTangentNode(0, 0, -1000.0, 0.0, -4312.5)
  373.     
  374.         cam.AddCameraNode(0, 1.0, -100875.0, -1000.0, -98750.0)
  375.         cam.SetCameraStartTangentNode(0, 1, -1250.0, 0.0, -5562.5)
  376.         cam.SetCameraEndTangentNode(0, 1, -3062.5, 0.0, -875.0)
  377.     
  378.         cam.AddCameraNode(0, 1.5, -103250.0, 0.0, -102125.0)
  379.         cam.SetCameraStartTangentNode(0, 2, -3812.5, 0.0, -1500.0)
  380.         cam.SetCameraEndTangentNode(0, 2, -4187.5, 0.0, 2062.5)
  381.     
  382.         cam.AddCameraNode(0, 1.50, -107250.0, 1000.0, -101875.0)
  383.         cam.SetCameraStartTangentNode(0, 3, -3937.5, 0.0, 1687.5)
  384.         cam.SetCameraEndTangentNode(0, 3, -2625.0, 0.0, 3000.0)
  385.     
  386.         cam.AddCameraNode(0, 2.0, -110625.0, 1500.0, -97250.0)
  387.         cam.SetCameraStartTangentNode(0, 4, -2500.0, 0.0, 2750.0)
  388.         cam.SetCameraEndTangentNode(0, 4, -4000.0, 0.0, 0.0)
  389.     
  390.         cam.AddCameraNode(0, 2.0, -114125.0, 1500.0, -95750.0)
  391.         cam.SetCameraStartTangentNode(0, 5, -4000.0, 0.0, 0.0)
  392.         cam.SetCameraEndTangentNode(0, 5, -1187.5, 0.0, -2687.5)
  393.     
  394.         cam.AddCameraNode(0, 1.5, -117250.0, 750.0, -97875.0)
  395.         cam.SetCameraStartTangentNode(0, 6, -1312.5, 0.0, -2687.5)
  396.         cam.SetCameraEndTangentNode(0, 6, 1250.0, 0.0, -2687.5)
  397.     
  398.         cam.AddCameraNode(0, 1.5, -117125.0, -250.0, -100875.0)
  399.         cam.SetCameraStartTangentNode(0, 7, 1125.0, 0.0, -2812.5)
  400.         cam.SetCameraEndTangentNode(0, 7, 2875.0, 0.0, -625.0)
  401.     
  402.         cam.AddCameraNode(0, 1.5, -114125.0, -1250.0, -103125.0)
  403.         cam.SetCameraStartTangentNode(0, 8, 2500.0, 0.0, -625.0)
  404.         cam.SetCameraEndTangentNode(0, 8, 3500.0, 0.0, 0.0)
  405.     
  406.         cam.AddCameraNode(0, 1.5, -110500.0, -1750.0, -103250.0)
  407.         cam.SetCameraStartTangentNode(0, 9, 3625.0, 0.0, 0.0)
  408.         cam.SetCameraEndTangentNode(0, 9, 2687.5, 0.0, 2250.0)
  409.     
  410.         cam.AddCameraNode(0, 3.0, -104000.0, -1750.0, -101375.0)
  411.         cam.SetCameraStartTangentNode(0, 10, 4437.5, 0.0, 3250.0)
  412.         cam.SetCameraEndTangentNode(0, 10, 1375.0, 0.0, 875.0)
  413.     
  414.         # Path target
  415.         cam.AddCameraNode(1, 3.0, tpos[0], tpos[1], tpos[2])
  416.         cam.AddCameraNode(1, 3.0, -114000.0, 0.0, -99500.0)
  417.         cam.AddCameraNode(1, 3.0, -110000.0, 0.0, -96000.0)
  418.  
  419.         cam.SType=1
  420.         cam.TType=1
  421.         cam.CameraStartPath(0)
  422.         cam.CameraStartPath(1)
  423.         cam.ChangeNodeFunc=DetieneCamaraChk
  424.         Bladex.AddScheduledFunc(Bladex.GetTime()+1.0, ApareceChk, ())
  425.         Scorer.SetVisible(0)
  426.         chaosk1.UnFreeze()
  427.  
  428.  
  429. def ReiniciaCamaraChaosK1():
  430.     global prevPViewType
  431.     cam=Bladex.GetEntity("Camera")
  432.     cam.SetPersonView("Player1")
  433.     cam.PViewType=prevPViewType
  434.     cam.Cut()
  435.     Bladex.ActivateInput()
  436.     #print("Hello my babe!")
  437.  
  438. def GiraCamara(obj_name, time):
  439.     global paso_n
  440.     global chaospos
  441.     global init_tpos
  442.     cam=Bladex.GetEntity("Camera")
  443.     vtpos=init_tpos[0]-chaospos[0], 0.0, init_tpos[2]-chaospos[2]
  444.     vtposnorm=B3DLib.Normalize(vtpos)
  445.     paso_n=paso_n+1
  446.     newvtposnorm=vtposnorm[0]*math.cos(paso_n*ANGLE_VARIATION)-vtposnorm[2]*math.sin(paso_n*ANGLE_VARIATION), 0.0, vtposnorm[0]*math.sin(paso_n*ANGLE_VARIATION)+vtposnorm[2]*math.cos(paso_n*ANGLE_VARIATION)
  447.     newvtpos=newvtposnorm[0]*2000, 0.0, newvtposnorm[2]*2000
  448.     cam.TPos=chaospos[0]+newvtpos[0], -250.0, chaospos[2]+newvtpos[2]
  449.     if paso_n==TOTAL_STEPS:
  450.         cam.RemoveFromList("Timer60")
  451.         cam.TimerFunc=""
  452.         ReiniciaCamaraChaosK1()
  453.         AbrePuertaCaos()
  454.         Bladex.AddScheduledFunc(Bladex.GetTime()+10.0, MusicTool.LaunchMusicEvent, ("suspenselento",))
  455.  
  456. def MuereChaosK1(entity_name):
  457.     global paso_n
  458.     global chaospos
  459.     global init_tpos
  460.     global prevPViewType
  461.     Bladex.DeactivateInput()
  462.     chaosk1.Data.Disappear(entity_name)
  463.     cam=Bladex.GetEntity("Camera")
  464.     char=Bladex.GetEntity("Player1")
  465.     charpos=char.Position
  466.     chaospos=chaosk1.Position
  467.     vtpos=chaospos[0]-charpos[0], 0.0, chaospos[2]-charpos[2]
  468.     vtposnorm=B3DLib.Normalize(vtpos)
  469.     newvtposnorm=vtposnorm[0]*math.cos(3.14159/2.0)-vtposnorm[2]*math.sin(3.14159/2.0), 0.0, vtposnorm[0]*math.sin(3.14159/2.0)+vtposnorm[2]*math.cos(3.14159/2.0)
  470.     newvtpos=newvtposnorm[0]*2000.0, 0.0, newvtposnorm[2]*2000.0
  471.     prevPViewType=cam.PViewType
  472.     cam.PViewType=0
  473.     cam.ESource="ChaosK1"
  474.     cam.TPos=chaospos[0]+newvtpos[0], -250.0, chaospos[2]+newvtpos[2]
  475.     cam.SType=2
  476.     cam.TType=0
  477.     init_tpos=cam.TPos
  478.     paso_n=0
  479.     cam.TimerFunc=GiraCamara
  480.     cam.SubscribeToList("Timer60")
  481.     darfuncs.UnhideBadGuy("22kngt")
  482.     darfuncs.UnhideBadGuy("23kngt")
  483.     #darfuncs.UnhideBadGuy("226kngt")
  484.     Bladex.ExeMusicEvent(Bladex.GetMusicEvent("emptyloquesea"), 1)
  485.  
  486.  
  487. #*************************************************************************************************
  488. #*************************************************************************************************
  489. #*************************************************************************************************
  490. #*******************************                                        **************************
  491. #*******************************   Definiciones para Cascadat.py        **************************
  492. #*******************************                                        **************************
  493. #*************************************************************************************************
  494. #*************************************************************************************************
  495.  
  496. def CreateCascada2(Cascada,p,d,v,pc,Time = 16,Grav = 13000,PPS = 800):
  497.     cascada=Bladex.CreateEntity(Cascada, "Entity Particle System D2",p[0],p[1],p[2])
  498.     cascada.D=d[0],d[1],d[2]
  499.     cascada.ParticleType="AguaC"
  500.     cascada.Friction=0.07
  501.     cascada.RandomVelocity=8.0
  502.     cascada.Velocity=v[0],v[1],v[2]
  503.     cascada.PPS=PPS
  504.     cascada.YGravity=Grav
  505.     cascada.Time2Live=Time
  506.  
  507.     espuma=Bladex.CreateEntity(Cascada+"Espuma", "Entity Particle System D2",pc[0],pc[1],pc[2])
  508.     espuma.D=d[0],d[1],d[2]
  509.     espuma.ParticleType="Espuma"
  510.     espuma.PPS=150
  511.     espuma.YGravity=0.0
  512.     espuma.Friction=0.07
  513.     espuma.Velocity=0.0, -1000.0, 0.0
  514.     espuma.RandomVelocity=30.0
  515.     espuma.RandomVelocity_V=30.0
  516.     espuma.Time2Live=10
  517.  
  518.  
  519. def BorrarCascada2(cascada):
  520.     cascada = Bladex.GetEntity(cascada)
  521.     cascada.SubscribeToList("Pin")
  522.     
  523.     espuma = Bladex.GetEntity(cascada+"Espuma")
  524.     espuma.SubscribeToList("Pin")
  525.  
  526.  
  527. #*************************************************************************************************
  528. #*************************************************************************************************
  529. #*************************************************************************************************
  530. #*******************************                                        **************************
  531. #*******************************   Definiciones para BurningKnights.py **************************
  532. #*******************************                                        **************************
  533. #*************************************************************************************************
  534. #*************************************************************************************************
  535.  
  536. def ReduceSmoke3():
  537.     global humo
  538.     humo.RandomVelocity=30.0
  539.     humo.Time2Live=30
  540.     humo.DeathTime=Bladex.GetTime()+3.0
  541.  
  542. def ReduceSmoke2():
  543.     global humo
  544.     humo.Position=-89500.0, -3200.0, 21750.0
  545.     humo.D=0.0, 0.0, -4250.0
  546.     humo.RandomVelocity=40.0
  547.     humo.Time2Live=40
  548.     Bladex.AddScheduledFunc(Bladex.GetTime()+11.0, ReduceSmoke3, ())
  549.  
  550. def ReduceSmoke1():
  551.     global humo
  552.     humo.Time2Live=60
  553.     Bladex.AddScheduledFunc(Bladex.GetTime()+5.0, ReduceSmoke2, ())
  554.  
  555. def LaunchSmoke():
  556.     global humo
  557.     humo=Bladex.CreateEntity("Humo", "Entity Particle System D2", -89500.0, -4000.0, 20750.0)
  558.     humo.D=0.0, 0.0, -3250.0
  559.     humo.ParticleType="LightDarkSmoke"
  560.     humo.PPS=30
  561.     humo.Time2Live=96
  562.     humo.Velocity=0.0, 0.0, 0.0
  563.     humo.RandomVelocity=60.0
  564.     humo.Friction=0.07
  565.     humo.YGravity=-2000
  566.     Bladex.AddScheduledFunc(Bladex.GetTime()+5.0, ReduceSmoke1, ())
  567.  
  568. def SetFireToBoxes (ObjectName,use_from):
  569.     # Call the standard SetFireTo UseFunc
  570.     Actions.StdSetFireToUseFunc(ObjectName,use_from)
  571.     char = Bladex.GetEntity("Player1")
  572.     AuxFuncs.GetSpot(Bladex.GetEntity(char.InvRight)).CastShadows = 0
  573.     Torchs.ExtingueAntorcha(char.InvRight)
  574.  
  575.     t = Bladex.GetTime()
  576.     t= t + 1
  577.  
  578.     for n in range(5):
  579.         o=Bladex.GetEntity("BKBox"+`n+1`)
  580.         o.Data.BurnTime=10-n #8-n/2.0
  581.  
  582.     Bladex.AddScheduledFunc(t, LaunchSmoke, ())
  583.  
  584.     # Set up some events
  585.  
  586.     toBurn1 = "BKBox1"
  587.     if ObjectName != toBurn1:
  588.         o=Bladex.GetEntity(toBurn1)
  589.         Reference.debugprint (toBurn1 + ": will be burnt")
  590.         o.Data.UsedBy = ObjectName
  591.         o.UseFunc=0
  592.         Bladex.AddScheduledFunc(t, Actions.SetAlight,(toBurn1,),"BKBox1")
  593.     
  594.     toBurn2 = "BKBox2"
  595.     if ObjectName != toBurn2:
  596.         o=Bladex.GetEntity(toBurn2)
  597.         Reference.debugprint (toBurn2 + ": will be burnt")
  598.         o.Data.UsedBy = ObjectName
  599.         o.UseFunc=0
  600.         Bladex.AddScheduledFunc(t, Actions.SetAlight,(toBurn2,),"BKBox2")
  601.  
  602.     toBurn3 = "BKBox3"
  603.     if ObjectName != toBurn3:
  604.         o=Bladex.GetEntity(toBurn3)
  605.         Reference.debugprint (toBurn3 + ": will be burnt")
  606.         o.Data.UsedBy = ObjectName
  607.         o.UseFunc=0
  608.         Bladex.AddScheduledFunc(t, Actions.SetAlight,(toBurn3,),"BKBox3")
  609.         
  610.     toBurn4 = "BKBox4"
  611.     if ObjectName != toBurn4:
  612.         o=Bladex.GetEntity(toBurn4)
  613.         Reference.debugprint (toBurn4 + ": will be burnt")
  614.         o.Data.UsedBy = ObjectName
  615.         o.UseFunc=0
  616.         Bladex.AddScheduledFunc(t, Actions.SetAlight,(toBurn4,),"BKBox4")
  617.  
  618.     toBurn5 = "BKBox5"
  619.     if ObjectName != toBurn5:
  620.         o=Bladex.GetEntity(toBurn5)
  621.         Reference.debugprint (toBurn5 + ": will be burnt")
  622.         o.Data.UsedBy = ObjectName
  623.         o.UseFunc=0
  624.         Bladex.AddScheduledFunc(t, Actions.SetAlight,(toBurn5,),"BKBox5")
  625.  
  626.     toBurn7 = "Robin"
  627.     if ObjectName != toBurn7:
  628.         o=Bladex.GetEntity(toBurn7)
  629.         Reference.debugprint (toBurn7 + ": will be burnt")                
  630.         o.Data.UsedBy = ObjectName
  631.         Bladex.AddScheduledFunc(t, o.Data.SetOnFire,(toBurn7,),"Robin")
  632.         Bladex.AddScheduledFunc(t+BoxBurnTime+3,    o.Data.StartRunning,(toBurn7,),"Robin")
  633.         Bladex.AddScheduledFunc(Bladex.GetTime()+10.0,GritaElQuemado,())
  634.         
  635.     
  636.     # Should sort the other boxes according to distance from this one
  637.     # add scheduled funcs to set them on fire from nearest to furthest
  638.     # add scheduled funcs to destroy them from topmost to bottommost
  639.  
  640. def GritaElQuemado():
  641.     BKnightScream.Play(-89366.8447634, -3601.40781545, 19428.7059865,0)
  642.     #print "Gritio de condena y muerte"
  643.  
  644. def Launch():
  645.     per=Bladex.GetEntity("Robin")
  646.     pos=per.Position        # Should be the boxes position
  647.     per.CatchOnFire (pos[0],pos[1], pos[2])
  648.     Bladex.AddScheduledFunc(Bladex.GetTime()+5.0,per.Data.StartRunning,("Robin",))    
  649.     
  650.  
  651.  
  652. #*************************************************************************************************
  653. #*************************************************************************************************
  654. #*************************************************************************************************
  655. #*******************************                                        **************************
  656. #*******************************   Definiciones para antorchas.py       **************************
  657. #*******************************                                        **************************
  658. #*************************************************************************************************
  659. #*************************************************************************************************
  660.  
  661. def Apagala(sectorindex,entityname): 
  662.     a = Bladex.GetEntity(entityname)
  663.     #print entityname
  664.     if a.Kind == "Antorcha":
  665.         Torchs.ExtingueAntorcha(entityname)
  666.         #print"ExtingeAntorcha"
  667.  
  668.  
  669. def Apagala2(sectorindex,entityname): 
  670.     a = Bladex.GetEntity(entityname)
  671.     #print entityname
  672.     if a.Kind == "Antorcha":
  673.         Torchs.ExtingueAntorcha(entityname)
  674.         #print"ExtingeAntorcha"
  675.  
  676. def Apagala3(sectorindex,entityname): 
  677.     a = Bladex.GetEntity(entityname)
  678.     #print entityname
  679.     if a.Kind == "Antorcha":
  680.         Torchs.ExtingueAntorcha(entityname)
  681.         #print"ExtingeAntorcha"
  682.  
  683. #*************************************************************************************************
  684. #*************************************************************************************************
  685. #*************************************************************************************************
  686. #*******************************                                        **************************
  687. #*******************************   Definiciones para escape.py          **************************
  688. #*******************************                                        **************************
  689. #*************************************************************************************************
  690. #*************************************************************************************************
  691.  
  692. def PolvoRoturaMuro():
  693.     polvorotura=Bladex.CreateEntity("PolvoRotura", "Entity Particle System D2", -110250, 8500, 86000)
  694.     polvorotura.ParticleType="WallDust"
  695.     polvorotura.D=2000, 0, 0
  696.     polvorotura.YGravity=0.0
  697.     polvorotura.Friction=0.2
  698.     polvorotura.PPS=480
  699.     polvorotura.Velocity=0.0, -1000.0, -2000.0
  700.     polvorotura.RandomVelocity=80.0
  701.     polvorotura.Time2Live=60
  702.     polvorotura.DeathTime=Bladex.GetTime()+3.0/60.0
  703.  
  704.  
  705.  
  706. ##################
  707. #     Accion     #
  708. ##################
  709.  
  710.  
  711. def ReiniciaCamara():
  712.     cam=Bladex.GetEntity("Camera")
  713.     cam.SetPersonView("Player1")
  714. #    print "camara reseteada..."
  715.  
  716. def DetieneCamara(entity_name, camera_element, node):
  717. #    print "nodo: "+`node`
  718.     if node==1:
  719.         cam=Bladex.GetEntity("Camera")
  720. #        print "me detengo..."
  721.         cam.SType=0
  722.         cam.CameraClearPath(0)
  723.         Bladex.ActivateInput()
  724.  
  725. def MueveCamara():
  726.     cam=Bladex.GetEntity("Camera")
  727.     opos=cam.Position
  728.     tpos=cam.TPos
  729. #    print "comienzo trayectoria..."
  730.     cam.AddCameraNode(0, 6.0, -109415, 3150, 82722)
  731.     cam.SetCameraStartTangentNode(0, 0, -6000.0, 0.0, 0.0)
  732.     cam.SetCameraEndTangentNode(0, 0, 0.0, 0.0, 6000.0)
  733.     cam.AddCameraNode(0, 6.0, -113000.0, 6000.0, 84000.0)
  734.     cam.SetCameraStartTangentNode(0, 1, 0.0, 0.0, 6000.0)
  735.     cam.SetCameraEndTangentNode(0, 1, 6000.0, 0.0, 0.0)
  736.     cam.AddCameraNode(0, 6.0, -109500.0, 6000.0, 87500.0)
  737.     cam.SetCameraStartTangentNode(0, 2, 6000.0, 0.0, 0.0)
  738.     cam.SetCameraEndTangentNode(0, 2, 0.0, 0.0, -6000.0)
  739.     cam.SType=1
  740.     cam.TType=0
  741.     cam.CameraStartPath(0)
  742.     cam.ChangeNodeFunc=DetieneCamara
  743.     AnimaPersonaje()
  744.  
  745. def RoturaMuroCelda():
  746. #    derrumbemurocelda.Play(-109500.0, 7500.0, 86000.0)
  747.     muroceldasup.DoBreak((0.0, 0.0, 1.6), (-109500.0, 7250.0, 85500.0), (0.0, 0.0, 0.0))
  748.     muroceldainf.DoBreak((0.0, 0.0, 1.4), (-109500.0, 7750.0, 85500.0), (0.0, 0.0, 0.0))
  749.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.5, PolvoRoturaMuro, ())
  750.     Bladex.AddScheduledFunc(Bladex.GetTime()+2.0, ReiniciaCamara, ())
  751.  
  752. def SonidoRotura():
  753.     derrumbemurocelda.Play(-109500.0, 7500.0, 86000.0)
  754.  
  755. def SonidoRocasAgua():
  756.     derrumbemuroagua.Play(-109500.0, 13000.0, 88000.0)
  757.  
  758. def AnimaPersonaje():
  759.     pj=Bladex.GetEntity("Player1")
  760.     pj.SetTmpAnmFlags(1, 1, 1, 0, 1, 1,0)
  761.     punteromuro.RemoveFromWorld()
  762.     pj.LaunchAnmType("push_wall")
  763.     pj.Position=-109500.0, 7750.0, 84300.0
  764.     pj.Angle = 0
  765.     pj.SetOnFloor()
  766.     Bladex.AddScheduledFunc(Bladex.GetTime()+5.0, SonidoRotura, ())
  767.     Bladex.AddScheduledFunc(Bladex.GetTime()+6.5, SonidoRocasAgua, ())
  768.     Bladex.AddScheduledFunc(Bladex.GetTime()+5.3, RoturaMuroCelda, ())
  769.  
  770. def DerribaMuro(obj_name, use_from):
  771.     pj=Bladex.GetEntity("Player1")
  772.     Bladex.DeactivateInput()
  773.     pj.Position=-109500.0, 7750.0, 84300.0
  774.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.0, MueveCamara, ())
  775.  
  776. #*************************************************************************************************
  777. #*************************************************************************************************
  778. #*************************************************************************************************
  779. #*******************************                                        **************************
  780. #*******************************   Definiciones para InicioScene.py     **************************
  781. #*******************************                                        **************************
  782. #*************************************************************************************************
  783. #*************************************************************************************************
  784.  
  785.  
  786. def Despierta2kngt(sec_idx, ent_name):
  787.     if ent_name=="Player1":
  788.         sec2kngt.OnEnter=""
  789.         k=Bladex.GetEntity("2kngt")
  790.         k.Blind=0
  791.         k.Deaf=0
  792.  
  793.  
  794. def StopCameraInicio(Camera,frame):
  795.     cam = Bladex.GetEntity("Camera")
  796.     cam.SetPersonView("Player1")
  797.     ScriptSkip.SkipScriptEnd()
  798.     Bladex.SetListenerPosition(1)
  799.     k = Bladex.GetEntity("2kngt")
  800.     inv = k.GetInventory()
  801.     inv.LinkRightHand("None")
  802.     ant = Bladex.GetEntity("Kngtant2")
  803.     ant.Position = -100491.9163488, 1927.6169906, 71910.102509
  804.     ant.Orientation = 0.512640833855, -0.408463507891, -0.678020298481, 0.332633882761
  805.     Actions.TakeObject("2kngt","RagnarEspadaromana2")
  806.     Actions.TakeObject("2kngt","RagnarEsc2kgt")
  807.     #Bladex.CDStop()
  808.     Scorer.SetVisible(1)
  809.  
  810.  
  811. def LanzaAnimInicio():
  812.     char= Bladex.GetEntity("Player1")
  813.     char.Angle = 3.1415/2
  814.     char.Position = -111712.383,8742.335,79385.813
  815.     char.SetTmpAnmFlags(1,1,1,0,5,1,0)
  816.     char.LaunchAnimation("Kgt_inicio_ragnar")
  817.  
  818.  
  819. def RagnarInicio():
  820.     Bladex.ExeMusicEvent(Bladex.GetMusicEvent("inicioragnar"))
  821.  
  822.     if Reference.DEMO_MODE==0:
  823.         GotoMapVars.MapText(2,"D_M2_T1")
  824.     
  825.     initial_time = Bladex.GetTime()    
  826.  
  827.     Scorer.SetVisible(0)
  828.     AuxFuncs.FadeFrom(2.0)
  829.     Bladex.AddScheduledFunc(initial_time+2.0, GameText.WriteText, ("M2T2",))
  830.     cam = Bladex.GetEntity("Camera")    
  831.     cam.SetMaxCamera("RagnarCamera1.cam",0,800)
  832.     cam.AddCameraEvent(-1,StopCameraInicio)    
  833.     ScriptSkip.SkipScriptStart("1erscript")
  834.     Bladex.SetListenerPosition(2)
  835.     
  836.     char= Bladex.GetEntity("Player1")
  837.     char.Life = 60
  838.     char.Angle = 3.1415/2
  839.     char.Position = -111712.383,8742.335,79385.813
  840.     #char.SetTmpAnmFlags(1,1,1,0,5,1,0)
  841.     #char.LaunchAnimation("Kgt_inicio_ragnar")
  842.     Bladex.AddScheduledFunc(initial_time+28.0+5.0, LanzaAnimInicio, ())
  843.     carcelero.Data.Duerme(carcelero.Name)
  844.  
  845.  
  846. def Apagala4(sectorindex,entityname): 
  847.     a = Bladex.GetEntity(entityname)
  848.     #print entityname
  849.     if a.Kind == "Antorcha":
  850.         Torchs.ExtingueAntorcha(entityname)
  851.         #print"ExtingeAntorcha"
  852.  
  853.  
  854. #*************************************************************************************************
  855. #*************************************************************************************************
  856. #*************************************************************************************************
  857. #*******************************                                        **************************
  858. #*******************************   Definiciones para positions.py       **************************
  859. #*******************************                                        **************************
  860. #*************************************************************************************************
  861. #*************************************************************************************************
  862.  
  863. def IrPosicion1():
  864.     Doors.Restore()
  865.     char=Bladex.GetEntity("Player1")
  866.     char.Position=-103000, -5000, 21000        # Patio Burning Knight
  867.     char.Angle=4.8
  868.  
  869. def IrPosicion2():
  870.     Doors.Restore()
  871.     char=Bladex.GetEntity("Player1")
  872.     #char.Position=-88000, -9000, 500        # Puente levadizo
  873.     #char.Position=    -91479.7264466, -8748.5, -8452.27476857
  874.     char.Position=-80340, -7696, 1430
  875.     char.Angle=1.9
  876.  
  877. def IrPosicion3():
  878.     Doors.Restore()
  879.     char=Bladex.GetEntity("Player1")
  880.     char.Position=-100000, 0, -84000        # Antes del Caballero del Caos
  881.     char.Angle=2.95
  882.  
  883. def IrPosicion4():
  884.     Doors.Restore()
  885.     char=Bladex.GetEntity("Player1")
  886.     char.Position=-136593, -12748.5, -88000  # Antes de Ragnar mandando enemigos
  887.     char.Angle=1.5
  888.  
  889. def IrPosicion5():
  890.     Doors.Restore()
  891.     char=Bladex.GetEntity("Player1")
  892.     char.Position=-101000, 6000, -98000        # En los pendulos
  893.     char.Angle=1.6
  894.  
  895. def IrPosicion6():
  896.     Doors.Restore()
  897.     char=Bladex.GetEntity("Player1")
  898.     char.Position=-142263, -29765, -89773        # Antes de Ragnar Â·ltimo
  899.     char.Angle=3.3
  900.  
  901. def IrPosicion7():
  902.     Doors.Restore()
  903.     char=Bladex.GetEntity("Player1")
  904.     char.Position=-100457, -6246, 54321        # Patio con 3 enemigos
  905.     char.Angle=1.9
  906.  
  907. def IrPosicion8():
  908.     Doors.Restore()
  909.     char=Bladex.GetEntity("Player1")
  910.     char.Position=-102575.028299, 18237.0, 69621.1240909    # catacumbas
  911.     char.Angle=1.5
  912.  
  913. def IrPosicion9():
  914.     Doors.Restore()
  915.     char=Bladex.GetEntity("Player1")
  916.     char.Position=-82795, 1751.5, -35599.0    # Test Action Areas
  917.     char.Angle=1.5
  918.  
  919.  
  920. #*************************************************************************************************
  921. #*************************************************************************************************
  922. #*************************************************************************************************
  923. #*******************************                                        **************************
  924. #*******************************   Definiciones para Pinchos.py         **************************
  925. #*******************************                                        **************************
  926. #*************************************************************************************************
  927. #*************************************************************************************************
  928.  
  929. def DeactivatePinchoOnHit (EntityName, VictimName, ImpX, ImpY, ImpZ):    
  930.     pass
  931.  
  932. def ActivatePinchos(Name,RangeMin,RangeMax):
  933.     pass
  934.  
  935. def DeactivatePinchos(Name,RangeMin,RangeMax):
  936.     pass
  937.  
  938.  
  939. #*************************************************************************************************
  940. #*************************************************************************************************
  941. #*************************************************************************************************
  942. #*******************************                                        **************************
  943. #*******************************   Definiciones para Pendulos.py        **************************
  944. #*******************************                                        **************************
  945. #*************************************************************************************************
  946. #*************************************************************************************************
  947.     
  948. def MueveLlamaradaGolpe(entity,time):
  949.     llam = Bladex.GetEntity(entity)    
  950.     llam.Position = char.Position
  951.  
  952.  
  953. def RotarPendulo(Entity,Timer):
  954.     Pen = Bladex.GetEntity(Entity)
  955.     llam = Bladex.GetEntity(Entity+"llamarada")
  956.     P = Pen.Data.DatosPendulo
  957.     Aceleracion = P.fAc * math.sin(P.Angulo)
  958.     P.Vel = P.Vel + Aceleracion
  959.     P.Angulo = P.Angulo + P.Vel
  960.     Pen.RotateRel(P.Piv[0],P.Piv[1],P.Piv[2],P.Axi[0],P.Axi[1],P.Axi[2],P.Vel * P.Dir)
  961.     pos = llam.Position
  962.     P.sound1.Position = pos
  963.     P.sound2.Position = pos
  964.  
  965.  
  966. def CreatePendulo(Name):
  967.     Pendulo = Bladex.GetEntity(Name)
  968.     Pen = def_class.PENDULO()
  969.     Pen.Pendulo = Pendulo
  970.     Pendulo.TimerFunc = RotarPendulo
  971.     Pendulo.Data.DatosPendulo = Pen
  972.     luzpendulo=AuxFuncs.GetSpot(Pendulo)
  973.     luzpendulo.Precission=0.5
  974.     luzpendulo.CastShadows=0
  975.     Pen.sound1=Sounds.CreateEntitySound('..\\..\\Sounds\\Fire-curtains.wav', 'SonidoPenduloNazo')
  976.     Pen.sound1.Volume=0.5
  977.     Pen.sound1.MinDistance=5000
  978.     Pen.sound1.MaxDistance=10000
  979.     Pen.sound2=Sounds.CreateEntitySound('..\\..\\Sounds\\fireball-swing.wav', 'SonidoPendulo')
  980.     Pen.sound2.Volume=0.5
  981.     Pen.sound2.MinDistance=5000
  982.     Pen.sound2.MaxDistance=10000
  983.     Pen.sound3=Sounds.CreateEntitySound('..\\..\\Sounds\\Flame-hole.wav', 'SonidoGolpe')
  984.     Pen.sound3.Volume=0.5
  985.     Pen.sound3.MinDistance=10000
  986.     Pen.sound3.MaxDistance=15000
  987.  
  988.     llamarada=Bladex.CreateEntity(Name+"llamarada", "Entity Particle System D1", 0,0,-4400)
  989.     llamarada.ParticleType="Flame"
  990.     llamarada.YGravity=-2000.0
  991.     llamarada.Friction=0.01
  992.     llamarada.PPS=100
  993.     llamarada.Velocity=0.0, 0.0, 0.0
  994.     llamarada.RandomVelocity=15.0
  995.     llamarada.Time2Live=20
  996.     Pendulo.Link(llamarada)
  997.  
  998.     return Pen
  999.  
  1000. def PlayerGolpeado(VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):    
  1001.     if (WeaponName == "Pendulo1" or WeaponName == "Pendulo2"):        
  1002.         char = Bladex.GetEntity("Player1")
  1003.         Pendulo = Bladex.GetEntity(WeaponName)
  1004.  
  1005.         P = Pendulo.Data.DatosPendulo
  1006.         D = P.Vel * P.Dir    
  1007.         Angle = char.Angle
  1008.         pos = char.Position
  1009.     
  1010.         P.sound3.Position = x,y,z
  1011.         P.sound3.PlaySound(0)
  1012.  
  1013.         llamarada=Bladex.CreateEntity("llamaradagol", "Entity Particle System D1", pos[0],12300,pos[2])
  1014.         llamarada.ParticleType="Explode"
  1015.         llamarada.YGravity=-2000.0
  1016.         llamarada.Friction=0.08
  1017.         llamarada.PPS=100
  1018.         llamarada.Velocity=0.0, 0.0, 0.0
  1019.         llamarada.RandomVelocity=100.0
  1020.         llamarada.Time2Live=20
  1021.         llamarada.DeathTime=Bladex.GetTime()+0.5
  1022.         llamarada.TimerFunc = MueveLlamaradaGolpe
  1023.         llamarada.SubscribeToList("Timer30")
  1024.         Bladex.AddScheduledFunc(Bladex.GetTime()+0.4, llamarada.RemoveFromList, ("Timer30",))
  1025.  
  1026.         NetSounds.AddAnimSound(char,'Kgt_dth_penl', MuerteBarb1, 5)
  1027.         NetSounds.AddAnimSound(char,'Kgt_dth_penr', MuerteBarb1, 5)
  1028.  
  1029.         char.SetTmpAnmFlags(1,1,1,0,5,1)        
  1030.  
  1031.         cam = Bladex.GetEntity("Camera")
  1032.         cam.SetTravellingView(0,2)
  1033.         cam.ETarget = "Player1"    
  1034.  
  1035.         if D > 0:
  1036.             if Angle < 3.14:                            
  1037.                 char.LaunchAnmType("dth_penr")
  1038.                 char.Angle = 1.55
  1039.             else:
  1040.                 char.LaunchAnmType("dth_penl")
  1041.                 char.Angle = 4.70
  1042.         else:
  1043.             if Angle < 3.14:
  1044.                 char.LaunchAnmType("dth_penl")
  1045.                 char.Angle = 1.55
  1046.             else:
  1047.                 char.LaunchAnmType("dth_penr")
  1048.                 char.Angle = 4.70
  1049.         
  1050.         char.Life = 0        
  1051.  
  1052. def Activar_Pendulos(sector,Entity):
  1053.     global Trampa_Pendulos    
  1054.     if Entity == "Player1" and Trampa_Pendulos == 0:
  1055.         Trampa_Pendulos = 1
  1056.  
  1057.         
  1058. def Desactivar_Pendulos(sector,Entity):
  1059.     global Trampa_Pendulos
  1060.     global DesactivarPendulos
  1061.     if Entity == "Player1" and DesactivarPendulos == 1:        
  1062.         char = Bladex.GetEntity("Player1")        
  1063.         char.DamageFunc = ExHitFunc
  1064.         DesactivarPendulos = 0
  1065.         Trampa_Pendulos = 0
  1066.         P1.Stop()
  1067.         P2.Stop()
  1068.  
  1069. def ActivarDesactivadoPendulos(sector,Entity):
  1070.     global DesactivarPendulos
  1071.     global ExHitFunc
  1072.     if Entity == "Player1":
  1073.         if DesactivarPendulos == 0:
  1074.             char = Bladex.GetEntity("Player1")
  1075.             ExHitFunc = char.DamageFunc
  1076.             char.DamageFunc = PlayerGolpeado
  1077.             DesactivarPendulos = 1
  1078.             P1.Play()
  1079.             P2.Play()
  1080.  
  1081.  
  1082.  
  1083.  
  1084. #*************************************************************************************************
  1085. #*************************************************************************************************
  1086. #*************************************************************************************************
  1087. #*******************************                                        **************************
  1088. #*******************************   Definiciones para Levadizo.py        **************************
  1089. #*******************************                                        **************************
  1090. #*************************************************************************************************
  1091. #*************************************************************************************************
  1092.  
  1093. def ReiniciaCamaraPuente():
  1094.     cam=Bladex.GetEntity("Camera")
  1095.     cam.Cut()
  1096.     cam.SetPersonView("Player1")
  1097.     Bladex.SetListenerPosition(1)
  1098.     Bladex.ActivateInput()
  1099.  
  1100. def DetieneCamaraPuente(entity_name, camera_element, node):
  1101.     if node==1:
  1102.         cam=Bladex.GetEntity("Camera")
  1103.         if camera_element==0:
  1104.             cam.SType=0
  1105.             cam.CameraClearPath(0)
  1106.             cam.TType=0
  1107.             cam.CameraClearPath(1)
  1108.  
  1109. def MueveCamaraPuente():
  1110.     Bladex.DeactivateInput()
  1111.     Bladex.SetListenerPosition(2)
  1112.     cam=Bladex.GetEntity("Camera")
  1113.     # Path objetivo
  1114.     cam.AddCameraNode(0, 6.0, -114500.0, -10000.0, -68000.0)
  1115.     cam.SetCameraStartTangentNode(0, 0, -6071.0, 0.0, 2821.3)
  1116.     cam.SetCameraEndTangentNode(0, 0, 4159.7, 0.0, 4320.8)
  1117.     cam.AddCameraNode(0, 6.0, -116500.0, 0.0, -59500.0)
  1118.     cam.SetCameraStartTangentNode(0, 1, 3945.5, 0.0, 4213.7)
  1119.     cam.SetCameraEndTangentNode(0, 1, 2500.0, 0.0, -1250.0)
  1120.     cam.AddCameraNode(0, 6.0, -106000.0, 0.0, -58000.0)
  1121.     cam.SetCameraStartTangentNode(0, 2, 2500.0, 0.0, -1250.0)
  1122.     cam.SetCameraEndTangentNode(0, 2, -1375.0, 0.0, -2500.0)
  1123.     # Path target
  1124.     cam.AddCameraNode(1, 6.0, -100500.0, -1000.0, -60000.0)
  1125.     cam.SetCameraStartTangentNode(1, 0, -6071.0, 0.0, 2821.3)
  1126.     cam.SetCameraEndTangentNode(1, 0, 4159.7, 0.0, 4320.8)
  1127.     cam.AddCameraNode(1, 6.0, -104500.0, -2000.0, -65000.0)
  1128.     cam.SetCameraStartTangentNode(1, 1, 3945.5, 0.0, 4213.7)
  1129.     cam.SetCameraEndTangentNode(1, 1, 2500.0, 0.0, -1250.0)
  1130.     cam.AddCameraNode(1, 6.0, -104500.0, 0.0, -70000.0)
  1131.     cam.SetCameraStartTangentNode(1, 2, 2500.0, 0.0, -1250.0)
  1132.     cam.SetCameraEndTangentNode(1, 2, -1375.0, 0.0, -2500.0)
  1133.     cam.SType=1
  1134.     cam.TType=1
  1135.     cam.CameraStartPath(0)
  1136.     cam.CameraStartPath(1)
  1137.     cam.ChangeNodeFunc=DetieneCamaraPuente
  1138.  
  1139.  
  1140. def GolpeFin():
  1141.  
  1142.     polvareda=Bladex.CreateEntity("PolvoGolpePuente", "Entity Particle System D2", -108250.0, 2250.0, -70500.0)
  1143.     polvareda.D=7500.0, 0.0, 0.0
  1144.     polvareda.ParticleType="LargeDust"
  1145.     polvareda.YGravity=0.0
  1146.     polvareda.Friction=0.2
  1147.     polvareda.PPS=900
  1148.     polvareda.DeathTime=Bladex.GetTime()+3.0/60.0
  1149.     polvareda.Velocity=0.0, -1000.0, 0.0
  1150.     polvareda.RandomVelocity=80.0
  1151.     angulos=(-3.14159/250.0, 3.14159/250.0)
  1152.     vel_ang_iniciales=(0.15, 0.0)
  1153.     vel_ang_finales=(0.0, 0.1)
  1154.     centros=((0.0, 7500.0, 0.0), (0.0, 7500.0, 0.0))
  1155.     ejes=((1, 0, 0), (1, 0, 0))
  1156.     Objects.NRotateObject(puentelevadizomovil, angulos, vel_ang_iniciales, vel_ang_finales, centros, ejes, Objects.REL)
  1157.     Bladex.AddScheduledFunc(Bladex.GetTime()+3.0, ReiniciaCamaraPuente, ())
  1158.     puentelevadizo.ExclusionMask=0
  1159.     pers1=Bladex.GetEntity("330kngt")
  1160.     pers2=Bladex.GetEntity("331kngt")
  1161.     if pers1 and pers1.Life>0:
  1162.         pers1.UnFreeze()
  1163.         pers1.Position=-96619, -9256, -54029
  1164.         pers1.Angle=5.68
  1165.     if pers2 and pers2.Life>0:
  1166.         pers2.UnFreeze()
  1167.         pers2.Position=-122000, -8770, -13000
  1168.         pers2.GoToJogging=1
  1169.         pers2.GoTo(-117000, -8770, -48000)
  1170.  
  1171.  
  1172. def InicioApertura():
  1173.  
  1174.     puentelevadizomovil.estado=1
  1175.     angulos=(3.14159/18.0, 5.0*3.14159/54.0, 3.14159/54.0, -3.14159/220.0, 3.14159/220.0)
  1176.     vel_ang_iniciales=(0.1, 0.25, 0.25, 0.25, 0.0)
  1177.     vel_ang_finales=(0.25, 0.25, 0.25, 0.0, 0.1)
  1178.     son_durante=(looppuentelevadizo, looppuentelevadizo, looppuentelevadizo, "", "")
  1179.     son_finales=("", "", atranquepuentelevadizo, "", "")
  1180.     centros=((0.0, 7500.0, 0.0), (0.0, 7500.0, 0.0), (0.0, 7500.0, 0.0), (0.0, 7500.0, 0.0), (0.0, 7500.0, 0.0))
  1181.     ejes=((1, 0, 0), (1, 0, 0), (1, 0, 0), (1, 0, 0), (1, 0, 0))
  1182.     Objects.NRotateObject(puentelevadizomovil, angulos, vel_ang_iniciales, vel_ang_finales, centros, ejes, Objects.REL, (), son_durante, son_finales)
  1183.  
  1184.  
  1185. def FinApertura():
  1186.  
  1187.     MueveCamaraPuente()
  1188.     puentelevadizomovil.estado=0
  1189.     angulos=(3.14159/9.0, 11.0*3.14159/54.0, 3.14159/54.0)
  1190.     vel_ang_iniciales=(0.1, 0.25, 0.25)
  1191.     vel_ang_finales=(0.25, 0.25, 0.15)
  1192.     son_durante=(looppuentelevadizo, looppuentelevadizo, looppuentelevadizo)
  1193.     son_finales=("", golpepuentelevadizo, "")
  1194.     centros=((0.0, 7500.0, 0.0), (0.0, 7500.0, 0.0), (0.0, 7500.0, 0.0))
  1195.     ejes=((1, 0, 0), (1, 0, 0), (1, 0, 0))
  1196.     Objects.NRotateObject(puentelevadizomovil, angulos, vel_ang_iniciales, vel_ang_finales, centros, ejes, Objects.REL, (), son_durante, son_finales, "", (), GolpeFin)
  1197.  
  1198.  
  1199. def BajaPuente():
  1200.  
  1201.     if (puentelevadizomovil.estado):
  1202.         FinApertura()
  1203.     else:
  1204.         InicioApertura()
  1205.         if char.Position[0]>-104500:
  1206.             pers=Bladex.GetEntity("331kngt")
  1207.         else:
  1208.             pers=Bladex.GetEntity("330kngt")
  1209.         if pers and pers.Life>0:
  1210.             pers.Freeze()
  1211.             pers.RemoveFromWorldWithChilds()
  1212.  
  1213.  
  1214. #*************************************************************************************************
  1215. #*************************************************************************************************
  1216. #*************************************************************************************************
  1217. #*******************************                                        **************************
  1218. #*******************************   Definiciones para Prisioners.py      **************************
  1219. #*******************************                                        **************************
  1220. #*************************************************************************************************
  1221. #*************************************************************************************************
  1222.  
  1223.  
  1224. def PrsHerido(entity_name):
  1225.   person=Bladex.GetEntity(entity_name)
  1226.   person.Data.Agoniza(entity_name)
  1227.  
  1228. def PrsMatado(entity_name):
  1229.   person=Bladex.GetEntity(entity_name)
  1230.   person.Data.Muere(entity_name)
  1231.  
  1232. ##################################
  1233. #     Prisioneros quejandose     #
  1234. ##################################
  1235.  
  1236. def QuejaPeriodica(prisionero):
  1237.   if prisionero.Data.Muerto:
  1238.     return
  1239.   prisionero.Data.Agoniza(prisionero.Name)
  1240.   variation=whrandom.uniform(-5.0, 5.0)
  1241.   Bladex.AddScheduledFunc(Bladex.GetTime()+15.0+variation, QuejaPeriodica, (prisionero,))
  1242.  
  1243. def IniciaPrisioneros(sector_index, entity_name):
  1244.   sectorinic.OnEnter=""
  1245.   QuejaPeriodica(prisionerovivo1)
  1246.   QuejaPeriodica(prisionerovivo2)
  1247.   prisioneromuerto.Life=-20
  1248.  
  1249.  
  1250. #*************************************************************************************************
  1251. #*************************************************************************************************
  1252. #*************************************************************************************************
  1253. #*******************************                                        **************************
  1254. #*******************************   Definiciones para Puertas.py         **************************
  1255. #*******************************                                        **************************
  1256. #*************************************************************************************************
  1257. #*************************************************************************************************
  1258.  
  1259. ##funciones abrir-cerrar##
  1260. def AbrePuertaLlaveen():
  1261.     puertaen.OpenDoor()
  1262.  
  1263. def Abrerastmaz1():
  1264.  
  1265.     desplazamientos=(1500.0, 1500.0)
  1266.     vectores=((0.0, -1.0, 0.0), (0.0, -1.0, 0.0))
  1267.     vel_iniciales=(0.0, 4000)
  1268.     vel_finales=(4000.0, 500)
  1269.     
  1270.     #sonidos asociados a la puerta-objeto rastmaz1
  1271.     son_iniciales=("", "")
  1272.     son_durante=(sonidorastrillo, sonidorastrillo)
  1273.     son_finales=("", golpemetalmediano)
  1274.     Objects.NDisplaceObject(rastmaz1din, desplazamientos, vectores, vel_iniciales, vel_finales, (), son_durante, son_finales)
  1275.  
  1276. def Cierrarastmaz1():
  1277.  
  1278.     desplazamientos=(1500.0, 1500.0, 700.0, 700.0, 250.0, 250.0)
  1279.     vectores=((0.0, 1.0, 0.0), (0.0, 1.0, 0.0), (0.0, -1.0, 0.0), (0.0, 1.0, 0.0), (0.0, -1.0, 0.0), (0.0, 1.0, 0.0))
  1280.     vel_iniciales=(0.0, 4000, 8000.0, 0.0, 6000.0, 0.0)
  1281.     vel_finales=(4000.0, 8000, 0.0, 6000.0, 0.0, 3000.0)
  1282.     
  1283.     #sonidos asociados a la puerta-objeto rastmaz1
  1284.     son_iniciales=("", "", "", "", "", "")
  1285.     son_durante=(sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo)
  1286.     son_finales=("", golpemetalmediano,"",golpemetalmediano,"",golpemetalmediano)
  1287.     Objects.NDisplaceObject(rastmaz1din, desplazamientos, vectores, vel_iniciales, vel_finales, (), son_durante, son_finales)
  1288.     
  1289. def Abrerastmaz2():
  1290.  
  1291.     desplazamientos=(1500.0, 1500.0)
  1292.     vectores=((0.0, -1.0, 0.0), (0.0, -1.0, 0.0))
  1293.     vel_iniciales=(0.0, 4000)
  1294.     vel_finales=(4000.0, 500)
  1295.  
  1296.     #sonidos asociados a la puerta-objeto rastmaz2
  1297.     son_iniciales=("", "")
  1298.     son_durante=(sonidorastrillo, sonidorastrillo)
  1299.     son_finales=("", golpemetalmediano)
  1300.     Objects.NDisplaceObject(rastmaz2din, desplazamientos, vectores, vel_iniciales, vel_finales, (), son_durante, son_finales)
  1301.     
  1302. def Cierrarastmaz2():
  1303.  
  1304.     desplazamientos=(1500.0, 1500.0, 700.0, 700.0, 250.0, 250.0)
  1305.     vectores=((0.0, 1.0, 0.0), (0.0, 1.0, 0.0), (0.0, -1.0, 0.0), (0.0, 1.0, 0.0), (0.0, -1.0, 0.0), (0.0, 1.0, 0.0))
  1306.     vel_iniciales=(0.0, 4000, 8000.0, 0.0, 6000.0, 0.0)
  1307.     vel_finales=(4000.0, 8000, 0.0, 6000.0, 0.0, 3000.0)
  1308.  
  1309.     #sonidos asociados a la puerta-objeto rastmaz2
  1310.     son_iniciales=("", "", "", "", "", "")
  1311.     son_durante=(sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo)
  1312.     son_finales=("", golpemetalmediano,"",golpemetalmediano,"",golpemetalmediano)
  1313.     Objects.NDisplaceObject(rastmaz2din, desplazamientos, vectores, vel_iniciales, vel_finales, (), son_durante, son_finales)
  1314.  
  1315. def Abrerastmaz3():
  1316.  
  1317.     desplazamientos=(1500.0, 1500.0)
  1318.     vectores=((0.0, -1.0, 0.0), (0.0, -1.0, 0.0))
  1319.     vel_iniciales=(0.0, 4000)
  1320.     vel_finales=(4000.0, 500)
  1321.  
  1322.     #sonidos asociados a la puerta-objeto rastmaz3
  1323.     son_iniciales=("", "")
  1324.     son_durante=(sonidorastrillo, sonidorastrillo)
  1325.     son_finales=("", golpemetalmediano)
  1326.     Objects.NDisplaceObject(rastmaz3din, desplazamientos, vectores, vel_iniciales, vel_finales, (), son_durante, son_finales)
  1327.  
  1328. def Cierrarastmaz3():
  1329.  
  1330.     desplazamientos=(1500.0, 1500.0, 700.0, 700.0, 250.0, 250.0)
  1331.     vectores=((0.0, 1.0, 0.0), (0.0, 1.0, 0.0), (0.0, -1.0, 0.0), (0.0, 1.0, 0.0), (0.0, -1.0, 0.0), (0.0, 1.0, 0.0))
  1332.     vel_iniciales=(0.0, 4000, 8000.0, 0.0, 6000.0, 0.0)
  1333.     vel_finales=(4000.0, 8000, 0.0, 6000.0, 0.0, 3000.0)
  1334.  
  1335.     #sonidos asociados a la puerta-objeto rastmaz3
  1336.     son_iniciales=("", "", "", "", "", "")
  1337.     son_durante=(sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo)
  1338.     son_finales=("", golpemetalmediano,"",golpemetalmediano,"",golpemetalmediano)
  1339.     Objects.NDisplaceObject(rastmaz3din, desplazamientos, vectores, vel_iniciales, vel_finales, (), son_durante, son_finales)
  1340.  
  1341. def CierraPuertaLlaveen(sectorindex,entityname):
  1342.     puertaen.CloseDoor()
  1343.  
  1344. def AbrePuerta1():
  1345.     global p1yaabierta
  1346.     puerta1.OpenDoor()
  1347.     if not p1yaabierta:
  1348.         pers=Bladex.GetEntity("330kngt")
  1349.         pers.Position=-79000, -9256, -42000
  1350.         pers.GoTo(-96619, -9256, -54029)
  1351.         p1yaabierta=1
  1352.  
  1353. def CierraPuerta1():
  1354.     puerta1.CloseDoor()
  1355.  
  1356. def AbrePuertaLlave2():
  1357.     puerta2.OpenDoor()
  1358.  
  1359. def CierraPuertaLlave2():
  1360.     puerta2.CloseDoor()
  1361.  
  1362. def AbrePuertaLlave3():
  1363.     puerta3.OpenDoor()
  1364.  
  1365. def CierraPuertaLlave3():
  1366.     puerta3.CloseDoor()
  1367.     
  1368. def CierraPuertaLlave33(sectorindex,entityname):
  1369.     puerta3.CloseDoor()
  1370.     
  1371. def AbrePuertaLlave4():
  1372.     puerta4.OpenDoor()
  1373.  
  1374. def CierraPuertaLlave4():
  1375.     puerta4.CloseDoor()
  1376.  
  1377. def AbrePuertaLlave5():
  1378.     puerta5.OpenDoor()
  1379.  
  1380. def CierraPuertaLlave5():
  1381.     puerta5.CloseDoor()
  1382.  
  1383. def AbrePuertaLlave6():
  1384.     global armaduraencontrada
  1385.     puerta6.OpenDoor()
  1386.     if armaduraencontrada:
  1387.         return
  1388.     armaduraencontrada=1
  1389.     Bladex.ExeMusicEvent(Bladex.GetMusicEvent("recompensa"))
  1390.  
  1391. def CierraPuertaLlave6():
  1392.     puerta6.CloseDoor()
  1393.  
  1394. def AbrePuertaLlave9():
  1395.     puerta9.OpenDoor()
  1396.  
  1397. def CierraPuertaLlave9():
  1398.     puerta9.CloseDoor()
  1399.  
  1400. def AbrePuertaLlave7():
  1401.     puerta7.OpenDoor()
  1402.  
  1403. def CierraPuertaLlave7():
  1404.     puerta7.CloseDoor()
  1405.  
  1406. def AbrePuerta8():
  1407.     puerta8.OpenDoor()
  1408.  
  1409. def CierraPuerta8():
  1410.     puerta8.CloseDoor()
  1411.  
  1412. def AbrePuertaLlave10():
  1413.     puerta10.OpenDoor()
  1414.  
  1415. def CierraPuertaLlave10():
  1416.     puerta10.CloseDoor()
  1417. ##funciones abrir-cerrar##
  1418.  
  1419. def FinCamaraRaspat():
  1420.     cam=Bladex.GetEntity("Camera")
  1421.     cam.SetPersonView("Player1")
  1422.     cam.Cut()
  1423.     Bladex.SetListenerPosition(1)
  1424.     Bladex.ActivateInput()
  1425.  
  1426. def Abrerastpat():
  1427.  
  1428.     desplazamientos=(1650.0, 1500.0)
  1429.     vectores=((0.0, -1.0, 0.0), (0.0, -1.0, 0.0))
  1430.     vel_iniciales=(0.0, 1000)
  1431.     vel_finales=(1000.0, 500)
  1432.     
  1433.     #sonidos asociados a la puerta-objeto rastpat
  1434.     son_iniciales=("", "")
  1435.     son_durante=(sonidorastrillo, sonidorastrillo)
  1436.     son_finales=("", golpemetalmediano)
  1437.     Objects.NDisplaceObject(rastpatdin, desplazamientos, vectores, vel_iniciales, vel_finales, (), son_durante, son_finales)
  1438.     Bladex.DeactivateInput()
  1439.     Bladex.SetListenerPosition(2)
  1440.     AuxFuncs.MoveCamFromTo(-95150.0, -14250.0, 42200.0, -91650.0, -9950.0, 49250.0, -101450.0, -12350.0, 34600.0, -93650.0, -7200.0, 39800.0, 6.0)
  1441.     Bladex.AddScheduledFunc(Bladex.GetTime()+7.0, FinCamaraRaspat, ())
  1442.  
  1443. def Cierrarastpat():
  1444.  
  1445.     desplazamientos=(1650.0, 1500.0, 700.0, 700.0, 250.0, 250.0)
  1446.     vectores=((0.0, 1.0, 0.0), (0.0, 1.0, 0.0), (0.0, -1.0, 0.0), (0.0, 1.0, 0.0), (0.0, -1.0, 0.0), (0.0, 1.0, 0.0))
  1447.     vel_iniciales=(0.0, 4000, 8000.0, 0.0, 6000.0, 0.0)
  1448.     vel_finales=(4000.0, 8000, 0.0, 6000.0, 0.0, 3000.0)
  1449.     
  1450.     #sonidos asociados a la puerta-objeto rastpat
  1451.     son_iniciales=("", "", "", "", "", "")
  1452.     son_durante=(sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo)
  1453.     son_finales=("", golpemetalmediano,"",golpemetalmediano,"",golpemetalmediano)
  1454.     Objects.NDisplaceObject(rastpatdin, desplazamientos, vectores, vel_iniciales, vel_finales, (), son_durante, son_finales)
  1455.  
  1456. def Cierrarastfin(sectorindex,entityname):
  1457.     
  1458.     if entityname=='Player1':
  1459.  
  1460.         desplazamientos=(1980.0, 1950.0, 700.0, 700.0, 250.0, 250.0)
  1461.         vectores=((0.0, 1.0, 0.0), (0.0, 1.0, 0.0), (0.0, -1.0, 0.0), (0.0, 1.0, 0.0), (0.0, -1.0, 0.0), (0.0, 1.0, 0.0))
  1462.         vel_iniciales=(0.0, 4000, 8000.0, 0.0, 6000.0, 0.0)
  1463.         vel_finales=(4000.0, 8000, 0.0, 6000.0, 0.0, 3000.0)
  1464.     
  1465.         #sonidos asociados a la puerta-objeto rastfin
  1466.         son_iniciales=("", "", "", "", "", "")
  1467.         son_durante=(sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo, sonidorastrillo)
  1468.         son_finales=("", golpemetalmediano,"",golpemetalmediano,"",golpemetalmediano)
  1469.         Objects.NDisplaceObject(rastfindin, desplazamientos, vectores, vel_iniciales, vel_finales, (), son_durante, son_finales)
  1470.         sr1.OnEnter=""
  1471.  
  1472. def AbrePuertaCaos():
  1473.     puertacaos.OpenDoor()
  1474.  
  1475. def CierraPuertaCaos(sectorindex,entityname):
  1476.     puertacaos.CloseDoor()
  1477.  
  1478. def CierraPuertaRagnar():
  1479.     puertaragnar.CloseDoor()
  1480. ##funciones abrir-cerrar##
  1481.  
  1482. def Abrerastrag():
  1483.  
  1484.     desplazamientos=(2250.0, 1000.0)
  1485.     vectores=((0.0, -1.0, 0.0), (0.0, -1.0, 0.0))
  1486.     vel_iniciales=(0.0, 2000)
  1487.     vel_finales=(2000.0, 500)
  1488.     
  1489.     #sonidos asociados a la puerta-objeto rastrag
  1490.     son_iniciales=("", "")
  1491.     son_durante=(sonidorastrillo, sonidorastrillo)
  1492.     son_finales=("", golpemetalmediano)
  1493.     Objects.NDisplaceObject(rastragdin, desplazamientos, vectores, vel_iniciales, vel_finales, (), son_durante, son_finales)
  1494.  
  1495. def AbrePuertaTres():
  1496.     puertatres.OpenDoor()
  1497.     enem = Bladex.GetEntity("tres1kngt")
  1498.     enem.Blind = 0
  1499.     enem.Deaf = 0
  1500.  
  1501. #*************************************************************************************************
  1502. #*************************************************************************************************
  1503. #*************************************************************************************************
  1504. #*******************************                                        **************************
  1505. #*******************************   Definiciones para Trampa_pinchos.py  **************************
  1506. #*******************************                                        **************************
  1507. #*************************************************************************************************
  1508. #*************************************************************************************************
  1509.  
  1510.  
  1511. #############################################################################################
  1512. #
  1513. #                                        PINCHOS
  1514. #
  1515. #############################################################################################
  1516.  
  1517. def ReactivarTecho():
  1518.     global Trampa_Estado
  1519.     #print ("Reactivando Trampa")
  1520.     Sonido_Trampa_Reactivada.Play(-124000,-25000,-100000,0)
  1521.     Trampa_Estado = 1;
  1522.  
  1523. def TrampaSubida(sld_name):
  1524.     polvo1=Bladex.CreateEntity("Polvo1", "Entity Particle System D2", -123000, -27000, -96000)
  1525.     polvo1.ParticleType="SpDust"
  1526.     polvo1.D=-3600, 0, 0
  1527.     polvo1.YGravity=0.0
  1528.     polvo1.Friction=0.2
  1529.     polvo1.PPS=480
  1530.     polvo1.Velocity=0.0, 3000.0, -2000.0
  1531.     polvo1.RandomVelocity=30.0
  1532.     polvo1.Time2Live=60
  1533.     polvo1.DeathTime=Bladex.GetTime()+5.0/60.0
  1534.     polvo2=Bladex.CreateEntity("Polvo2", "Entity Particle System D2", -123000, -27000, -104500)
  1535.     polvo2.ParticleType="SpDust"
  1536.     polvo2.D=-3600, 0, 0
  1537.     polvo2.YGravity=0.0
  1538.     polvo2.Friction=0.2
  1539.     polvo2.PPS=480
  1540.     polvo2.Velocity=0.0, 3000.0, 2000.0
  1541.     polvo2.RandomVelocity=30.0
  1542.     polvo2.Time2Live=60
  1543.     polvo2.DeathTime=Bladex.GetTime()+5.0/60.0
  1544.     DesactivarPincho("Pincho1")
  1545.     DesactivarPincho("Pincho2")
  1546.     DesactivarPincho("Pincho3")
  1547.     DesactivarPincho("Pincho4")
  1548.     DesactivarPincho("Pincho5")
  1549.     DesactivarPincho("Pincho6")
  1550.     DesactivarPincho("Pincho7")
  1551.     DesactivarPincho("Pincho8")
  1552.     DesactivarPincho("Pincho9")
  1553.     DesactivarPincho("Pincho10")
  1554.     DesactivarPincho("Pincho11")
  1555.     Sonido_Trampa_Subiendo1.Stop()
  1556.     Sonido_Hit2.Play(-124000,-25000,-100000,0)
  1557.     Bladex.AddScheduledFunc(Bladex.GetTime()+1.5,ReactivarTecho,())
  1558.  
  1559.  
  1560. def SubirTecho():
  1561.     arenilla1=Bladex.CreateEntity("Arenilla1", "Entity Particle System D2", -123000, -26500, -96000)
  1562.     arenilla1.D=-3600, 0, 0
  1563.     arenilla1.ParticleType="Sand"
  1564.     arenilla1.YGravity=4900.0
  1565.     arenilla1.Friction=0.2
  1566.     arenilla1.RandomVelocity=10.0
  1567.     arenilla1.PPS=512
  1568.     arenilla1.Time2Live=32
  1569.     arenilla1.DeathTime=Bladex.GetTime()+6.5
  1570.     arenilla2=Bladex.CreateEntity("Arenilla2", "Entity Particle System D2", -123000, -26500, -104500)
  1571.     arenilla2.D=-3600, 0, 0
  1572.     arenilla2.ParticleType="Sand"
  1573.     arenilla2.YGravity=4900.0
  1574.     arenilla2.Friction=0.2
  1575.     arenilla2.RandomVelocity=10.0
  1576.     arenilla2.PPS=512
  1577.     arenilla2.Time2Live=32
  1578.     arenilla2.DeathTime=Bladex.GetTime()+6.5
  1579.     Techo_Pinchos1.sld_area().OnStopFunc = TrampaSubida
  1580.     Techo_Pinchos1.sld_area().SlideTo(0,-100,-200)
  1581.     Techo_Pinchos2.sld_area().SlideTo(0,-100,-200)
  1582.     Techo_Pinchos3.sld_area().SlideTo(0,-100,-200)
  1583.     Techo_Pinchos1.sld_area().HitFunc = None
  1584.     Techo_Pinchos2.sld_area().HitFunc = None
  1585.     Techo_Pinchos3.sld_area().HitFunc = None
  1586.     Sonido_Trampa_Subiendo1.Play(-124000,-22000,-100000,0)
  1587.     Sonido_Trampa_Subiendo2.Play(-124000,-22000,-100000,0)
  1588.  
  1589.  
  1590. def BajarTecho():
  1591.     Techo_Pinchos1.sld_area().OnStopFunc = TrampaBajada
  1592.     Techo_Pinchos1.sld_area().SlideTo(4600,6600,4800)
  1593.     Techo_Pinchos2.sld_area().SlideTo(4600,6600,4800)
  1594.     Techo_Pinchos3.sld_area().SlideTo(4600,6600,4800)
  1595.     Techo_Pinchos1.sld_area().HitFunc = Doors.DoorHit
  1596.     Techo_Pinchos2.sld_area().HitFunc = Doors.DoorHit
  1597.     Techo_Pinchos3.sld_area().HitFunc = Doors.DoorHit
  1598.     #Sonido_Trampa_Bajando1.Play(-124000,-25000,-100000,0)
  1599.     Sonido_Trampa_Bajando2.Play(-124000,-25000,-100000,0)
  1600.  
  1601.  
  1602. def TrampaBajada(sld_name):
  1603.     #Char = Bladex.GetEntity("Player1")
  1604.     polvo3=Bladex.CreateEntity("Polvo3", "Entity Particle System D2", -123000, -22000, -96000)
  1605.     polvo3.ParticleType="SpDust"
  1606.     polvo3.D=-3600, 0, 0
  1607.     polvo3.YGravity=0.0
  1608.     polvo3.Friction=0.2
  1609.     polvo3.PPS=480
  1610.     polvo3.Velocity=0.0, -2000.0, 4000.0
  1611.     polvo3.RandomVelocity=40.0
  1612.     polvo3.Time2Live=60
  1613.     polvo3.DeathTime=Bladex.GetTime()+3.0/60.0
  1614.     polvo4=Bladex.CreateEntity("Polvo4", "Entity Particle System D2", -123000, -22000, -104500)
  1615.     polvo4.ParticleType="SpDust"
  1616.     polvo4.D=-3600, 0, 0
  1617.     polvo4.YGravity=0.0
  1618.     polvo4.Friction=0.2
  1619.     polvo4.PPS=480
  1620.     polvo4.Velocity=0.0, -2000.0, -4000.0
  1621.     polvo4.RandomVelocity=40.0
  1622.     polvo4.Time2Live=60
  1623.     polvo4.DeathTime=Bladex.GetTime()+3.0/60.0
  1624.     Bladex.AddScheduledFunc(Bladex.GetTime() + 1.5,SubirTecho,())
  1625.     #Sonido_Trampa_Bajando1.Stop()
  1626.     #Sonido_Trampa_Bajando2.Stop()
  1627.     Sonido_Hit2.Play(-124000,-22000,-100000,0)
  1628.  
  1629. ##############    TECHO ############
  1630.  
  1631. def PinchoSigueTecho(Nombre,Tiempo):
  1632.     Techo = Bladex.GetEntity("TechoPinchos")
  1633.     Pincho = Bladex.GetEntity(Nombre)
  1634.     X = Pincho.Position[0]
  1635.     Z = Pincho.Position[2]
  1636.     D = Techo.Displacement    
  1637.     Y = -26100 + D
  1638.     Pincho.Position = X,Y,Z
  1639.  
  1640. def ActivarPincho(Nombre):
  1641.     Pincho = Bladex.GetEntity(Nombre)
  1642.     Bladex.CreateTimer("Timer60",1.0/60.0)
  1643.     #Pincho.Weapon = 1
  1644.     Pincho.Solid = 0
  1645.     #Pincho.Static = 1
  1646.     Pincho.TimerFunc = PinchoSigueTecho
  1647.     Pincho.SubscribeToList("Timer60")
  1648.  
  1649. def DesactivarPincho(Nombre):
  1650.     Pincho = Bladex.GetEntity(Nombre)
  1651.     Pincho.RemoveFromList("Timer60")
  1652.  
  1653. def DesactivarTrampaPinchos():    
  1654.     global Trampa_Estado
  1655.     Trampa_Estado = 0    
  1656.     #Techo_Pinchos.OpenDoor()
  1657.  
  1658.     SubirTecho()
  1659.  
  1660. def ActivarTecho():    
  1661.     #Techo_Pinchos.CloseDoor()
  1662.     BajarTecho()
  1663.     ActivarPincho("Pincho1")
  1664.     ActivarPincho("Pincho2")
  1665.     ActivarPincho("Pincho3")
  1666.     ActivarPincho("Pincho4")
  1667.     ActivarPincho("Pincho5")
  1668.     ActivarPincho("Pincho6")
  1669.     ActivarPincho("Pincho7")
  1670.     ActivarPincho("Pincho8")
  1671.     ActivarPincho("Pincho9")
  1672.     ActivarPincho("Pincho10")
  1673.     ActivarPincho("Pincho11")
  1674.         
  1675.  
  1676. def ActivarTrampaPinchos(Sector,Entity_Name):    
  1677.     global Trampa_Puerta_Abandonada
  1678.     global Trampa_Estado
  1679.     #print("Entrando Trampa")
  1680.     if (Trampa_Estado==1 and Trampa_Puerta_Abandonada==0):
  1681.         Bladex.AddScheduledFunc(Bladex.GetTime()+0.5,ActivarTecho,())
  1682.         Sonido_Trampa_Activada.Play(-124000,-25000,-100000)
  1683.         #print("Trampa Activada")
  1684.         Trampa_Puerta_Abandonada = 0
  1685.         Trampa_Estado = 0
  1686.  
  1687. def AbandonarPuerta(Sector,Entity_Name):
  1688.     global Trampa_Puerta_Abandonada
  1689.     Trampa_Puerta_Abandonada = 1
  1690.  
  1691. #*************************************************************************************************
  1692. #*************************************************************************************************
  1693. #*************************************************************************************************
  1694. #*******************************                                        **************************
  1695. #*******************************   Definiciones para Trampa_flechas.py  **************************
  1696. #*******************************                                        **************************
  1697. #*************************************************************************************************
  1698. #*************************************************************************************************
  1699.  
  1700.  
  1701. def PararFlecha(Arrow_P,Tiempo):
  1702.     Arrow = Bladex.GetEntity(Arrow_P.Lanzar)
  1703.     Arrow.MessageEvent(Reference.MESSAGE_STOP_WEAPON,0,0)    
  1704.     Arrow.MessageEvent(Reference.MESSAGE_STOP_TRAIL, 0,0)
  1705.     Arrow.Orientation    = Arrow_P.Orientation
  1706.     Arrow.Position        = Arrow_P.Position
  1707.     Arrow.Scale            = Arrow_P.Scale
  1708.     #Arrow_P.Sound.Stop()
  1709.  
  1710.  
  1711. def PasoPolvo(polvoposition, paso, trampa):
  1712.  
  1713.     if paso:
  1714.         if (trampa):
  1715.             despl=1150
  1716.         else:
  1717.             despl=-1150
  1718.         polvoflecha=Bladex.CreateEntity("PolvoFlecha3", "Entity Particle System D1", polvoposition[0]+despl, polvoposition[1], polvoposition[2])
  1719.         polvoflecha.ParticleType="Dust3"
  1720.         polvoflecha.YGravity=0.0
  1721.         polvoflecha.Friction=0.2
  1722.         polvoflecha.PPS=60
  1723.         polvoflecha.Time2Live=15
  1724.         polvoflecha.DeathTime=Bladex.GetTime()+3.0/60.0
  1725.     else:
  1726.         if (trampa):
  1727.             despl=950
  1728.         else:
  1729.             despl=-950
  1730.         polvoflecha=Bladex.CreateEntity("PolvoFlecha2", "Entity Particle System D1", polvoposition[0]+despl, polvoposition[1], polvoposition[2])
  1731.         polvoflecha.ParticleType="Dust2"
  1732.         polvoflecha.YGravity=0.0
  1733.         polvoflecha.Friction=0.2
  1734.         polvoflecha.PPS=60
  1735.         polvoflecha.Time2Live=15
  1736.         polvoflecha.DeathTime=Bladex.GetTime()+3.0/60.0
  1737.         Bladex.AddScheduledFunc(Bladex.GetTime()+2.0/60.0, PasoPolvo, (polvoposition, 1, trampa),"PasoPolvo")
  1738.  
  1739.  
  1740.  
  1741. def LanzarFlecha(Arrow_P,Tiempo):        
  1742.     Arrow = Bladex.GetEntity(Arrow_P.Lanzar)
  1743.  
  1744.     if (Arrow_P.Estado == 1):
  1745.         #print ("Lanzando",Arrow_P.Lanzar)
  1746.         polvoposition=Arrow.Position[0], Arrow.Position[1]+70, Arrow.Position[2]
  1747.         char=Bladex.GetEntity("Player1")
  1748.         if (char.Position[0]<-135000.0):
  1749.             despl=750
  1750.             trampa=1
  1751.         else:
  1752.             despl=-750
  1753.             trampa=0
  1754.         Arrow.MessageEvent(Reference.MESSAGE_START_WEAPON,0,0)
  1755.         Arrow.MessageEvent(Reference.MESSAGE_START_TRAIL, 0,0)
  1756.         
  1757.         Arrow.Fly(40000 * Arrow_P.Avance,0,0)
  1758.         #Arrow_P.Ultimo_Lanzamiento = Bladex.GetTime()
  1759.         Arrow_P.Sound.Play(Arrow.Position[0],Arrow.Position[1],Arrow.Position[2],0)
  1760.         polvoflecha=Bladex.CreateEntity("PolvoFlecha", "Entity Particle System D1", polvoposition[0]+despl, polvoposition[1], polvoposition[2])
  1761.         polvoflecha.ParticleType="Dust1"
  1762.         polvoflecha.YGravity=0.0
  1763.         polvoflecha.Friction=0.2
  1764.         polvoflecha.PPS=60
  1765.         polvoflecha.Time2Live=15
  1766.         polvoflecha.DeathTime=Bladex.GetTime()+3.0/60.0
  1767.         Bladex.AddScheduledFunc(Bladex.GetTime()+2.0/60.0, PasoPolvo, (polvoposition, 0, trampa),"PasoPolvo")
  1768.         Bladex.AddScheduledFunc(Bladex.GetTime() + Arrow_P.Tiempo_Parada,PararFlecha,(Arrow_P,0),"PararFlecha")
  1769.         Bladex.AddScheduledFunc(Bladex.GetTime() + Arrow_P.Tiempo_Lanzamiento,LanzarFlecha,(Arrow_P,0),"LanzarFlecha")
  1770.  
  1771.  
  1772.  
  1773. def ActivarFlecha(Name,Tiempo):    
  1774.     Arrow = Bladex.GetEntity(Name)
  1775.     #print(Arrow.Data.Lanzar," Activado")    
  1776.     Arrow.Data.Estado = 1
  1777.     Bladex.AddScheduledFunc(Tiempo,LanzarFlecha,(Arrow.Data,0),"LanzarFlecha")
  1778.  
  1779. def DesactivarFlecha(Name):    
  1780.     Arrow = Bladex.GetEntity(Name)
  1781.     #print(Arrow.Data.Lanzar," Desactivado")
  1782.     Arrow.Data.Estado = 0
  1783.  
  1784. def ActivarTrampaFlechas(sector,entity_Name):
  1785.     global Trampa_Flechas_Activada1
  1786.     global Trampa_Flechas    
  1787.     global Player_Intro1
  1788.  
  1789.     if (entity_Name == "Player1"):
  1790.         if (Trampa_Flechas == 0):
  1791.             #print("Trampa Flechas Activada")            
  1792.             Player_Intro1 = 1
  1793.             if (Trampa_Flechas_Activada1 == 0):
  1794.                 Tiempo = Bladex.GetTime()            
  1795.                 ActivarFlecha("Pivote10",Tiempo + 1)#0.6)
  1796.                 ActivarFlecha("Pivote11",Tiempo + 0)
  1797.                 ActivarFlecha("Pivote12",Tiempo + 1.5)#0.9)
  1798.                 ActivarFlecha("Pivote13",Tiempo + 0.5)#0.3)
  1799.                 char = Bladex.GetEntity("Player1")
  1800.                 Sonido_Flechas_Activadas.Play(-141000,-7000,char.Position[2],0)
  1801.                 Trampa_Flechas_Activada1 = 1
  1802.                 
  1803.         
  1804.         Trampa_Flechas = Trampa_Flechas + 1            
  1805.  
  1806. def DesactivarTrampa1():
  1807.     global Trampa_Flechas_Activada1
  1808.     global Player_Intro1
  1809.     global Tiempo_DesactivacionFlechas1
  1810.     Tiempo = Bladex.GetTime()
  1811.     #print ("Bucle Desactivacion: Tiempo Actual ",Tiempo,"Tiempo Des ",Tiempo_DesactivacionFlechas1)
  1812.     if (Tiempo_DesactivacionFlechas1 <= Tiempo):
  1813.         if (Player_Intro1 == 0):        
  1814.             #print("Desactivado")
  1815.             DesactivarFlecha("Pivote10")
  1816.             DesactivarFlecha("Pivote11")
  1817.             DesactivarFlecha("Pivote12")
  1818.             DesactivarFlecha("Pivote13")
  1819.             Trampa_Flechas_Activada1 = 0
  1820.             Sonido_Flechas_Desactivadas.Play(-141000,-7000,-100000,0)
  1821.             return
  1822.     else:
  1823.         #print("Configurada Siguiente Desactivacion")
  1824.         Bladex.AddScheduledFunc(Tiempo_DesactivacionFlechas1,DesactivarTrampa1,(),"DesactivarTrampa1")
  1825.  
  1826.  
  1827. def DesactivarTrampaFlechas(sector,entity_Name):    
  1828.     global Tiempo_DesactivacionFlechas1
  1829.     global Trampa_Flechas
  1830.     global Player_Intro1
  1831.  
  1832.     if (entity_Name == "Player1"):
  1833.         Trampa_Flechas = Trampa_Flechas - 1
  1834.  
  1835.         if (Trampa_Flechas == 0):
  1836.             #print("Trampa Flechas Desactivada")
  1837.             Player_Intro1 = 0
  1838.             Tiempo = Bladex.GetTime()
  1839.             if (Tiempo_DesactivacionFlechas1 <= Tiempo):
  1840.                 Bladex.AddScheduledFunc(Tiempo + 6.0,DesactivarTrampa1,(),"DesactivarTrampa1")
  1841.             Tiempo_DesactivacionFlechas1 = Tiempo + 6.1
  1842.  
  1843.  
  1844. def ActivarTrampaFlechas2(sector,entity_Name):
  1845.     global Trampa_Flechas_Activada2
  1846.     global Trampa_Flechas    
  1847.     global Player_Intro2
  1848.  
  1849.     if (entity_Name == "Player1"):
  1850.         if (Trampa_Flechas == 0):
  1851.             Player_Intro2 = 1
  1852.             if (Trampa_Flechas_Activada2 == 0):
  1853.                 #print("Trampa Flechas Activada")
  1854.                 Tiempo = Bladex.GetTime()
  1855.                 ActivarFlecha("Pivote0",Tiempo + 0)
  1856.                 ActivarFlecha("Pivote1",Tiempo + 0.5)#0.3)
  1857.                 ActivarFlecha("Pivote2",Tiempo + 1)#0.6)
  1858.                 ActivarFlecha("Pivote3",Tiempo + 1.5)#0.9)                
  1859.                 Sonido_Flechas_Activadas.Play(-125000,-7000,char.Position[2],0)
  1860.                 Trampa_Flechas_Activada2 = 1
  1861.  
  1862.         Trampa_Flechas = Trampa_Flechas + 1
  1863.  
  1864. def DesactivarFlechas2():
  1865.     global Trampa_Flechas_Activada2    
  1866.     global Player_Intro2
  1867.  
  1868.     Tiempo = Bladex.GetTime()
  1869.     if (Tiempo_DesactivacionFlechas2 <= Tiempo):
  1870.         if (Player_Intro2 == 0):
  1871.             Trampa_Flechas_Activada2 = 0
  1872.             DesactivarFlecha("Pivote0")
  1873.             DesactivarFlecha("Pivote1")
  1874.             DesactivarFlecha("Pivote2")
  1875.             DesactivarFlecha("Pivote3")
  1876.             Sonido_Flechas_Desactivadas.Play(-125000,-7000,-100000,0)
  1877.             return
  1878.     else:
  1879.         Bladex.AddScheduledFunc(Tiempo_DesactivacionFlechas2,DesactivarFlechas2,(),"DesactivarFlechas2")
  1880.  
  1881.  
  1882. def DesactivarTrampaFlechas2(sector,entity_Name):
  1883.     global Tiempo_DesactivacionFlechas2
  1884.     global Trampa_Flechas_Activada2    
  1885.     global Trampa_Flechas
  1886.     global Player_Intro2
  1887.  
  1888.     if (entity_Name == "Player1"):
  1889.         Trampa_Flechas = Trampa_Flechas - 1
  1890.  
  1891.         if (Trampa_Flechas == 0):        
  1892.             #print("Trampa Flechas Desactivada")
  1893.             Player_Intro2 = 0
  1894.             Tiempo = Bladex.GetTime()
  1895.             if (Tiempo_DesactivacionFlechas2 <= Tiempo):                
  1896.                 Bladex.AddScheduledFunc(Tiempo + 6.0,DesactivarFlechas2,(),"DesactivarFlechas2")
  1897.             Tiempo_DesactivacionFlechas2 = Tiempo + 6.0
  1898.  
  1899. def StickArrow(Sticker,Stick):
  1900.     #print (Sticker," Clavada en ",Stick)
  1901.     Arrow = Bladex.GetEntity(Sticker)
  1902.     Flecha = Arrow.Data        
  1903.     NewArrow = Traps_C.Prueba(Flecha.Nombre,Flecha.Flechas_Clavadas)    
  1904.     Flecha.Flechas_Clavadas = Flecha.Flechas_Clavadas + 1
  1905.     Arrow = Bladex.CreateEntity(NewArrow,"Flecha",Flecha.Position[0],Flecha.Position[1],Flecha.Position[2])
  1906.     Arrow.Orientation = Flecha.Orientation
  1907.     Arrow.Scale = Flecha.Scale
  1908.     Arrow.Arrow = 1
  1909.     Flecha.Lanzar = NewArrow
  1910.     Arrow.Data = Flecha
  1911.     Arrow.StickFunc = StickArrow
  1912.  
  1913.  
  1914. def InitArrow(Name,Displacement):    
  1915.     A = def_class.FLECHA()
  1916.     A.Avance = Displacement
  1917.     Arrow = Bladex.GetEntity(Name)
  1918.     
  1919.     A.Sound = Bladex.CreateSound('..\\..\\Sounds\\dart-shoot.wav', 'LaunchArrow')
  1920.     A.Sound.Volume=0.3
  1921.     A.Sound.MinDistance=7000
  1922.     A.Sound.MaxDistance=10000
  1923.         
  1924.     A.Nombre      = Name
  1925.     A.Lanzar      = Name
  1926.     A.Position    = Arrow.Position
  1927.     A.Orientation = Arrow.Orientation    
  1928.     A.Scale       = Arrow.Scale
  1929.     
  1930.     Arrow.Data = A
  1931.     Arrow.StickFunc = StickArrow
  1932.  
  1933. #*************************************************************************************************
  1934. #*************************************************************************************************
  1935. #*************************************************************************************************
  1936. #*******************************                                        **************************
  1937. #*******************************   Definiciones para Talking_Knights.py **************************
  1938. #*******************************                                        **************************
  1939. #*************************************************************************************************
  1940. #*************************************************************************************************
  1941.  
  1942.  
  1943. #######################################################
  1944. # Setup the sector
  1945. #######################################################
  1946.  
  1947. def LookAtTerry():
  1948.     # Lets set up a temporary camera to watch the fun
  1949.     #pdb.set_trace()
  1950.     cam = Bladex.GetEntity("Camera")
  1951.     cam.LookAtTime=5
  1952.     cam.Position=-84589, -9783, -6064
  1953.     cam.LookAt("Terry")        
  1954.  
  1955. def OnEnterScript(SectorIndex, EntityName):
  1956.     if EntityName=="Player1":        
  1957.         #pdb.set_trace()
  1958.         Reference.debugprint ("Player1 has entered sector "+`SectorIndex`)
  1959.  
  1960.         eric = Bladex.GetEntity ("Eric")
  1961.         if eric:
  1962.             #eric.Position=-91610, -8748, -7916
  1963.             eric.Angle=4.4
  1964.             eric.Data.StartTalking1 ()
  1965.         terry = Bladex.GetEntity ("Terry")        
  1966.         #LookAtTerry()
  1967.         if terry:
  1968.             #terry.Position =-86500, -8748, -7250        
  1969.             terry.Angle=1.5
  1970.             terry.Data.StartTalking2 ()
  1971.         sec=Bladex.GetSector(SectorIndex)
  1972.         sec.OnEnter=0
  1973.         Bladex.CheckPyErrors()
  1974.  
  1975. def Reset():
  1976.     targetSec=Bladex.GetSector(-80340, -7696, 1430)
  1977.     targetSec.OnEnter=OnEnterScript
  1978.  
  1979.  
  1980. #*************************************************************************************************
  1981. #*************************************************************************************************
  1982. #*************************************************************************************************
  1983. #*******************************                                        **************************
  1984. #*******************************   Definiciones para Ragnar_Actions.py  **************************
  1985. #*******************************                                        **************************
  1986. #*************************************************************************************************
  1987. #*************************************************************************************************
  1988.  
  1989. def FuncionNula(entity_name):
  1990.     pass
  1991.  
  1992.  
  1993. ####################################################
  1994. #     Lanza sonido activacion trampa cuchillas     #
  1995. ####################################################
  1996.  
  1997. def SonidoActivacion(sector_index, entity_name):
  1998.     if entity_name=="Player1":
  1999.         cuchillasactivadas.Play(-141790.0, -23249.0, -99000.0, 0)
  2000.         sectorsonidocuchillas.OnEnter=""
  2001.  
  2002.  
  2003. def RagnarDesaparece(newpos=(0.0, 0.0, 0.0), seefunc=FuncionNula):
  2004.     ragnar.LaunchAnimation("Rgn_rlx_1h")
  2005.     ragnar.Position=newpos
  2006.     ragnar.SeeFunc=seefunc
  2007.     ragnar.SetOnFloor()
  2008.  
  2009.  
  2010. def GuardaEnGuardia(person):
  2011. #    print "En guardia!"
  2012.     person.LaunchAnimation("Tkn_rlx_f")
  2013.     person.SetOnFloor()
  2014.  
  2015. def GuardaAtaca(person):
  2016. #    print "Al ataque!"    
  2017.     person.Blind=0    
  2018.     person.Data.LaunchMyWatch(person.Name)
  2019.  
  2020. def VozMatadle():
  2021.     matadle.Play(-142500.0, -12750.0, -110700.0, 0)
  2022.  
  2023. def DesactivaCambiosMusicaGuardaespaldas():
  2024.     Bladex.ExeMusicEvent(Bladex.GetMusicEvent("musicatorre"))
  2025.     Bladex.RemoveTriggerSectorFunc("MusicaTorre4", "OnEnter")
  2026.     Bladex.RemoveTriggerSectorFunc("Silencio7", "OnEnter")
  2027.  
  2028. def RagnarEscapaEnemigos():
  2029.     ragnar.Position=-142500.0, -12750.0, -110700.0
  2030.     ragnar.SetOnFloor()
  2031.     ragnar.Data.CommandingAndEscaping()
  2032.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.5, VozMatadle, ())
  2033.     Bladex.AddScheduledFunc(Bladex.GetTime()+1.5, GuardaEnGuardia, (guarda1,))
  2034.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.5, GuardaEnGuardia, (guarda2,))
  2035.     Bladex.AddScheduledFunc(Bladex.GetTime()+2.5, GuardaAtaca, (guarda1,))
  2036.     Bladex.AddScheduledFunc(Bladex.GetTime()+1.5, GuardaAtaca, (guarda2,))
  2037.     newpos=(-141790.0, -23249.0, -109700.0)
  2038.     Bladex.AddScheduledFunc(Bladex.GetTime()+3.0, RagnarDesaparece, (newpos, RagnarVeJugadorCuchillas))
  2039.     Bladex.AddScheduledFunc(Bladex.GetTime()+5.0, DesactivaCambiosMusicaGuardaespaldas, ())
  2040.  
  2041.  
  2042. def RagnarVeJugadorEnemigos(entity_name):
  2043. #    print "Ragnar te ha visto!"
  2044.     Bladex.ExeMusicEvent(Bladex.GetMusicEvent("ragnarguardaesp"))
  2045.     Bladex.AddScheduledFunc(Bladex.GetTime()+1.0, RagnarEscapaEnemigos, ())
  2046.     ragnar.SeeFunc=FuncionNula
  2047.     AbreCam.LastTime = 0.01
  2048.     AbreCam.PTS = [
  2049.            ((-141702.115016, -14316.6380986, -87909.7057797), (-142366.840758, -13202.867904, -92220.6355477), 0.75), 
  2050.            ((-144069.469394, -13937.8515248, -100755.479001), (-143651.345295, -13319.4865829, -103140.823385), 1.0), 
  2051.            ((-141904.34761, -13938.8061199, -100580.194813), (-142164.701223, -13320.5010469, -102987.636615), 3.0)]
  2052.     AbreCam.AbreCam()    
  2053.  
  2054. ##########################################################
  2055. #     Ragnar activando trampa de cuchillas y huyendo     #
  2056. ##########################################################
  2057.  
  2058. def RagnarEscapaCuchillas():
  2059.     ragnar.Position = (-141790.0, -23249.0, -109700.0)
  2060.     ragnar.SetOnFloor()
  2061.     ragnar.Data.Escaping(1)
  2062.     newpos=(-128000.0, -31750.0, -92000.0)
  2063.     Bladex.AddScheduledFunc(Bladex.GetTime()+2.5, RagnarDesaparece, (newpos,))
  2064.  
  2065.  
  2066. def RagnarVeJugadorCuchillas(entity_name):
  2067. #    print "Ragnar te ha visto!"
  2068.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.5, RagnarEscapaCuchillas, ())
  2069.     ragnar.SeeFunc=FuncionNula
  2070.  
  2071. ###
  2072. # Final con fundido
  2073. ###
  2074.  
  2075. def FundidoFin():
  2076.     char=Bladex.GetEntity("Player1")
  2077.     Bladex.DeactivateInput()
  2078.     Scorer.SetVisible(0)
  2079.     AuxFuncs.FadeTo(2.5, 28.5)
  2080.     Bladex.ExeMusicEvent(Bladex.GetMusicEvent("documentoragnar"))
  2081.     Bladex.AddScheduledFunc(Bladex.GetTime()+3.0, GameText.WriteText, ("M2T4",))       # aparicion text en pantalla
  2082.     if Reference.DEMO_MODE==0:
  2083.         Bladex.AddScheduledFunc(Bladex.GetTime()+28.0,GotoMapVars.EndOfLevel,())
  2084.         GotoMapVars.MapText(2,"D_M2_T2")
  2085.     else:
  2086.         Bladex.AddScheduledFunc(Bladex.GetTime()+28.0,Bladex.LoadLevel,("Casa",))
  2087.  
  2088.  
  2089. def PolvoPuertaRagnar():
  2090.     polvopuertarg=Bladex.CreateEntity("PolvoPuertaRg", "Entity Particle System D2", -143875, -30275, -95625)
  2091.     polvopuertarg.ParticleType="RgDoorDust"
  2092.     polvopuertarg.D=3250, 0, 0
  2093.     polvopuertarg.YGravity=0.0
  2094.     polvopuertarg.Friction=0.2
  2095.     polvopuertarg.PPS=960
  2096.     polvopuertarg.Velocity=0.0, -2600.0, -2600.0
  2097.     polvopuertarg.RandomVelocity=40.0
  2098.     polvopuertarg.Time2Live=40
  2099.     polvopuertarg.DeathTime=Bladex.GetTime()+3.0/60.0
  2100.  
  2101. def CamaraSigueJugador(obj_name, time):
  2102.     char=Bladex.GetEntity("Player1")
  2103.     cam=Bladex.GetEntity("Camera")
  2104.     cam.TPos=char.Position
  2105.  
  2106. def ReiniciaCamaraRagnar():
  2107.     global original_dist
  2108.     cam=Bladex.GetEntity("Camera")
  2109.     cam.SetPersonView("Player1")
  2110. #    cam.Dist=original_dist
  2111.     cam.Cut()
  2112.     cam.Dist=original_dist
  2113. #    AuxFuncs.ActivateKeyboard()
  2114.     Bladex.ActivateInput()
  2115.  
  2116. def CamaraSigueRagnar(obj_name, time):
  2117.     cam=Bladex.GetEntity("Camera")
  2118.     #cam.TPos=ragnar.Position
  2119.     cam.TPos=ragnar.Position[0], ragnar.Position[1]+2300.0, ragnar.Position[2]
  2120.  
  2121. def RagnarAtaca():
  2122.     ragnar.Blind=0
  2123.     ragnar.Deaf=0
  2124.     ragnar.SeeFunc = ragnar.Data.StdSeeTheEnemy
  2125.     ragnar.Data.LaunchMyWatch(ragnar.Name)
  2126.  
  2127. def RagnarEnGuardia():
  2128. #    ragnar.LaunchAnmType("rlx_f")
  2129.     ragnar.LaunchAnimation("Rgn_rlx_f")
  2130.     person.SetOnFloor()    
  2131.     Bladex.AddScheduledFunc(Bladex.GetTime()+3.0, RagnarAtaca, ())
  2132.     Bladex.AddScheduledFunc(Bladex.GetTime()+2.0, ReiniciaCamaraRagnar, ())
  2133.  
  2134. def RagnarSePara(entity_name):
  2135.     cam=Bladex.GetEntity("Camera")
  2136.     cam.RemoveFromList("Timer60")
  2137.     cam.TimerFunc=""
  2138.     ragnar.Face(1.05)
  2139.     Bladex.AddScheduledFunc(Bladex.GetTime()+1.0, RagnarEnGuardia, ())
  2140.  
  2141. def RagnarSigueAndando(entity_name):
  2142.     global nodo_n
  2143. #    print "estoy en el nodo "+`nodo_n`
  2144.     nodo_pos=[(-130500, -32750, -101250), (-132500, -32750, -102500), (-135000, -32750, -103000)]
  2145.     ragnar.GoTo(nodo_pos[nodo_n][0], nodo_pos[nodo_n][1], nodo_pos[nodo_n][2])
  2146.     if nodo_n==2:
  2147.         ragnar.RouteEndedFunc=RagnarSePara
  2148.     else:
  2149.         nodo_n=nodo_n+1
  2150.         ragnar.RouteEndedFunc=RagnarSigueAndando
  2151.  
  2152. def RagnarEmpiezaAndar():
  2153.     cam=Bladex.GetEntity("Camera")
  2154. #    dialogoragnar.Play(-132500, -32750, -102500, 0)
  2155. #    ragnar.GoTo(-129250.0, -32750.0, -99250.0)
  2156.     ragnar.GoTo(-130500.0, -32750.0, -100000.0)
  2157.     ragnar.RouteEndedFunc=RagnarSigueAndando
  2158.     ragnar.LookAtEntity("Player1")
  2159.     cam.TimerFunc=CamaraSigueRagnar
  2160.     cam.SubscribeToList("Timer60")
  2161.  
  2162. def DetieneTargetRagnar(entity_name, camera_element, node):
  2163.     if node==1:
  2164.         global nodo_n
  2165.         nodo_n=0
  2166.         cam=Bladex.GetEntity("Camera")
  2167.         cam.TType=0
  2168.         cam.CameraClearPath(1)
  2169.         Bladex.AddScheduledFunc(Bladex.GetTime()+1.0, RagnarEmpiezaAndar, ())
  2170.  
  2171. def MiraRagnar():
  2172.     cam=Bladex.GetEntity("Camera")
  2173.     tpos=cam.TPos
  2174.     rgpos=ragnar.Position
  2175.     # Path target
  2176.     cam.AddCameraNode(1, 1.0, tpos[0], tpos[1], tpos[2])
  2177.     cam.AddCameraNode(1, 1.0, rgpos[0], rgpos[1]+3000.0, rgpos[2])
  2178.     cam.AddCameraNode(1, 1.0, -130000.0, -31750.0, -88000.0)
  2179.     cam.TType=1
  2180.     cam.CameraStartPath(1)
  2181.     cam.ChangeNodeFunc=DetieneTargetRagnar
  2182.  
  2183. def RieRagnar():
  2184.     rgpos=ragnar.Position
  2185.     risaragnar.Play(rgpos[0], rgpos[1], rgpos[2], 0)
  2186.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.5, MiraRagnar, ())
  2187.  
  2188. def DetieneTargetCuervos(entity_name, camera_element, node):
  2189.     if node==1:
  2190.         cam=Bladex.GetEntity("Camera")
  2191.         cam.TType=0
  2192.         cam.CameraClearPath(1)
  2193.         Bladex.AddScheduledFunc(Bladex.GetTime()+1.5, RieRagnar, ())
  2194.  
  2195. def MiraCuervos():
  2196.     char=Bladex.GetEntity("Player1")
  2197.     cam=Bladex.GetEntity("Camera")
  2198.     opos=cam.Position
  2199.     tpos=cam.TPos
  2200.     v=tpos[0]-opos[0], tpos[1]-opos[1], tpos[2]-opos[2]
  2201.     vnorm=B3DLib.Normalize(v)
  2202.     cam.ESource="Player1"
  2203.     cam.SType=2
  2204.     # Path target
  2205.     cam.AddCameraNode(1, 2.0, tpos[0]+vnorm[0]*2000, tpos[1]+vnorm[1]*2000, tpos[2]+vnorm[2]*2000)
  2206.     cam.AddCameraNode(1, 2.0, -127000.0, -43900.0, -106100.0)
  2207.     cam.AddCameraNode(1, 2.0, -127000.0, -46900.0, -106100.0)
  2208.     cam.TType=1
  2209.     cam.CameraStartPath(1)
  2210.     cam.ChangeNodeFunc=DetieneTargetCuervos
  2211.     graznidocuervo.Play(-135000.0, -42000.0, -102000.0, 0)
  2212.     char.Face(4.0*3.14159/3.0)
  2213.  
  2214. def SigueConCuervos(entity_name):
  2215.     global original_dist
  2216.     cam=Bladex.GetEntity("Camera")
  2217.     cam.RemoveFromList("Timer60")
  2218.     cam.TimerFunc=""
  2219.     cam.SetPersonView("Player1")
  2220.     original_dist=cam.Dist
  2221.     cam.Dist=1800.0
  2222.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.5, MiraCuervos, ())
  2223.     ragnar.Position=-127000.0, -31750.0, -92000.0
  2224.     ragnar.Angle=3.14159
  2225.     ragnar.SeeFunc=FuncionNula
  2226.  
  2227. def Camara2RagnarFinalTermina(x,y):
  2228.     cam = Bladex.GetEntity("Camera")
  2229.     cam.SetPersonView("Player1")
  2230.     ScriptSkip.SkipScriptEnd()
  2231.     Bladex.SetListenerPosition(1)
  2232.     Scorer.SetVisible(1)
  2233.     Bladex.AddScheduledFunc(Bladex.GetTime()+3.0, RagnarAtaca, ())
  2234.     #RagnarAtaca()
  2235.  
  2236. def PlayPasitoRagnar1(a,b):
  2237.     _Pasito.Play(ragnar.Position[0], ragnar.Position[1],-ragnar.Position[2], 0)
  2238.  
  2239. def PlayPasitoRagnar2(a,b):
  2240.     _Pasito1.Play(ragnar.Position[0], ragnar.Position[1],-ragnar.Position[2], 0)
  2241.     
  2242.  
  2243. def Camara2RagnarFinal(x,y):
  2244.     cam=Bladex.GetEntity("Camera")
  2245.     cam.SetMaxCamera("end_ragnarCamera02.cam",121,500)
  2246.     
  2247.     cam.AddCameraEvent(176-121,PlayPasitoRagnar2)
  2248.     cam.AddCameraEvent(155-121,PlayPasitoRagnar1)
  2249.     cam.AddCameraEvent(177-121,PlayPasitoRagnar2)
  2250.     cam.AddCameraEvent(198-121,PlayPasitoRagnar1)
  2251.     cam.AddCameraEvent(220-121,PlayPasitoRagnar2)
  2252.     cam.AddCameraEvent(241-121,PlayPasitoRagnar1)
  2253.     cam.AddCameraEvent(267-121,PlayPasitoRagnar2)
  2254.     cam.AddCameraEvent(289-121,PlayPasitoRagnar1)
  2255.     cam.AddCameraEvent(306-121,PlayPasitoRagnar2)
  2256.     cam.AddCameraEvent(325-121,PlayPasitoRagnar1)
  2257.     cam.AddCameraEvent(348-121,PlayPasitoRagnar2)
  2258.     cam.AddCameraEvent(367-121,PlayPasitoRagnar1)
  2259.     cam.AddCameraEvent(389-121,PlayPasitoRagnar2)
  2260.     cam.AddCameraEvent(409-121,PlayPasitoRagnar1)
  2261.     cam.AddCameraEvent(430-121,PlayPasitoRagnar2)
  2262.     cam.AddCameraEvent(453-121,PlayPasitoRagnar1)
  2263.     cam.AddCameraEvent(466-121,PlayPasitoRagnar2)
  2264.  
  2265.     cam.AddCameraEvent(-1,Camara2RagnarFinalTermina)
  2266.     
  2267.     
  2268.  
  2269. def Camara1RagnarCaminante(x,y):
  2270.     ragnar.Position = (-127795.461,-31432.037,-94747.914)
  2271.     ragnar.Angle=3.14159
  2272.     ragnar.Wuea = Reference.WUEA_ENDED
  2273.     ragnar.SetTmpAnmFlags(1,1,1,0,5,1)
  2274.     ragnar.LaunchAnimation("Rgn_end_ragnar_ragnar")
  2275.     ragnar.SetOnFloor()
  2276.     Bladex.AddScheduledFunc(Bladex.GetTime()+1.0, GameText.WriteText, ("M2T3",))       # aparicion text en pantalla
  2277.  
  2278. def EntraHabitacionFinal(sector_index, entity_name):
  2279.     if entity_name=="Player1":
  2280.         ScriptSkip.SkipScriptStart("ragnaranda")
  2281.         sectorfinragnar.OnEnter=""
  2282.         cam=Bladex.GetEntity("Camera")
  2283.         cam.SetMaxCamera("end_ragnarCamera01.cam",0,120)
  2284.         #cam.AddCameraEvent(111,Camara1RagnarCaminante)
  2285.         Bladex.AddScheduledFunc(Bladex.GetTime()+111.0/20.0, Camara1RagnarCaminante,(0,0))
  2286.         cam.AddCameraEvent(-1,Camara2RagnarFinal)
  2287.         Scorer.SetVisible(0)
  2288.  
  2289.         char=Bladex.GetEntity("Player1")
  2290.         char.Angle=3.14159
  2291.         char.Position = (-142408.234,-31634.457,-98412.711)
  2292.         char.Wuea = Reference.WUEA_ENDED
  2293.         char.SetTmpAnmFlags(1,1,1,0,5,1)
  2294.         char.LaunchAnmType("end_ragnar")
  2295.         Bladex.AddScheduledFunc(Bladex.GetTime()+0.25, char.SetOnFloor,())
  2296.  
  2297.         puertaragnar.OnEndCloseFunc=PolvoPuertaRagnar
  2298.         Bladex.AddScheduledFunc(Bladex.GetTime()+1.25, puertaragnar.CloseDoor, ())
  2299.         Bladex.AddScheduledFunc(Bladex.GetTime()+2.0, MusicTool.LaunchMusicEvent, ("locuraragnar",))
  2300.         sec=Bladex.GetSector(sector_index)
  2301.         sec.OnEnter=""
  2302.  
  2303.  
  2304. def ActivaCuervosVolando(sector_index, entity_name):
  2305.     if entity_name=="Player1":
  2306.         sectorantesfinragnar.OnEnter=""
  2307.         cuervovolando1.TurnOn()
  2308.         cuervovolando2.TurnOn()
  2309.  
  2310.  
  2311. #*************************************************************************************************
  2312. #*************************************************************************************************
  2313. #*************************************************************************************************
  2314. #*******************************                                        **************************
  2315. #*******************************   Definiciones para traps.py           **************************
  2316. #*******************************                                        **************************
  2317. #*************************************************************************************************
  2318. #*************************************************************************************************
  2319.  
  2320.  
  2321. def StopBlade(blade):
  2322.     blade.TimerFunc=None
  2323.     blade.RemoveFromList("Timer60")
  2324.  
  2325. def RegetBlade1():
  2326.     blade = Bladex.GetEntity("Blade1")
  2327.     Sonido_Cuchilla1_Recogida.Play(blade.Position[0],blade.Position[1],blade.Position[2],0);
  2328.  
  2329. def RegetBlade2():
  2330.     blade = Bladex.GetEntity("Blade2")
  2331.     Sonido_Cuchilla2_Recogida.Play(blade.Position[0],blade.Position[1],blade.Position[2],0);
  2332.  
  2333. def Blade1RTimerFunc(blade_name,time):
  2334.     global b1_time
  2335.     itime=time-b1_time
  2336.     blade=Bladex.GetEntity(blade_name)
  2337.     if(itime<3.0):
  2338.         blade.SetPosition(-138250,-23598,-97000-2666.6*itime,0)
  2339.     blade.Rotate(0.0,1.0,0.0,-0.1,1)
  2340.     if(itime>3.0):
  2341.         StopBlade(blade)
  2342.  
  2343. def Blade2RTimerFunc(blade_name,time):
  2344.     global b2_time
  2345.     global blades_ready
  2346.     itime=time-b2_time
  2347.     blade=Bladex.GetEntity(blade_name)
  2348.     if(itime<3.0):
  2349.         blade.SetPosition(-145250,-23124,-97000-2666.6*itime,0)
  2350.     blade.Rotate(0.0,1.0,0.0,0.1,1)
  2351.     if(itime>3.0):
  2352.         StopBlade(blade)
  2353.         Sonido_TrampaCuchilla_Reactivada.Play(-145250,-23124,-98500,0)        
  2354.         #blades_ready=1
  2355.  
  2356.  
  2357. def RBlade1():
  2358.     global b1_time
  2359.     b1_time=Bladex.GetTime()
  2360.     blade=Bladex.GetEntity("Blade1")
  2361.     #Sonido_Cuchilla1_Activada.Play(blade.Position[0],blade.Position[1],blade.Position[2],0)
  2362.     blade.Solid=0
  2363.     blade.TimerFunc=Blade1RTimerFunc
  2364.     blade.SubscribeToList("Timer60")
  2365.     #Bladex.AddScheduledFunc(Bladex.GetTime()+4.0,StopBlade,("Blade1"))
  2366.     
  2367.  
  2368. def RBlade2():
  2369.     global b2_time
  2370.     b2_time=Bladex.GetTime()
  2371.     blade=Bladex.GetEntity("Blade2")
  2372.     #Sonido_Cuchilla2_Activada.Play(blade.Position[0],blade.Position[1],blade.Position[2],0)
  2373.     blade.Solid=0
  2374.     blade.TimerFunc=Blade2RTimerFunc
  2375.     blade.SubscribeToList("Timer60")
  2376.     #Bladex.AddScheduledFunc(Bladex.GetTime()+4.0,StopBlade,("Blade2"))
  2377. def ApagaLuzChispa(luz):
  2378.  
  2379.     luz.SubscribeToList("Pin")
  2380.  
  2381.  
  2382. def LaunchBlade1():
  2383.     global b1_time
  2384.     Sonido_Cuchilla1_Activada.Play(-138250,-23598,-105000,0)
  2385.     b1_time=Bladex.GetTime()
  2386.     blade=Bladex.GetEntity("Blade1")
  2387.     blade.Position=-138250,-23598,-105000
  2388.     luzchispa1=Bladex.CreateEntity("LuzChispa1", "Entity Spot", blade.Position[0]-200, blade.Position[1], blade.Position[2]+1500)
  2389.     luzchispa1.Color=255, 140, 0
  2390.     luzchispa1.Intensity=1.5
  2391.     luzchispa1.Visible=0
  2392.     luzchispa1.CastShadows=0
  2393.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.6, ApagaLuzChispa,(luzchispa1,))
  2394.     chispas1=Bladex.CreateEntity("Chispas1", "Entity Particle System D1", blade.Position[0], blade.Position[1], blade.Position[2]+1500)
  2395.     chispas1.ParticleType="Spark"
  2396.     chispas1.YGravity=0.0
  2397.     chispas1.Friction=0.0
  2398.     chispas1.PPS=2048
  2399.     chispas1.Velocity=-4000.0, 0.0, -4000.0
  2400.     chispas1.RandomVelocity=30.0
  2401.     chispas1.Time2Live=8
  2402.     chispas1.DeathTime=Bladex.GetTime()+0.6
  2403.     blade.Solid=0
  2404.     blade.MessageEvent(MESSAGE_START_WEAPON,0,0)
  2405.     blade.TimerFunc=Blade1TimerFunc
  2406.     blade.SubscribeToList("Timer60")
  2407.     Bladex.AddScheduledFunc(Bladex.GetTime()+1.0,RegetBlade1,())
  2408.     
  2409.  
  2410. def Blade1TimerFunc(blade_name,time):
  2411.     global b1_time
  2412.     itime=time-b1_time
  2413.     blade=Bladex.GetEntity(blade_name)
  2414.     blade.MessageEvent(MESSAGE_START_WEAPON,0,0)
  2415.     if(itime<1.0):
  2416.         blade.SetPosition(-138250+(-6000.0+6000.0*itime)*itime,-23598,-105000+(16000.0-8000*itime)*itime,0)
  2417.         if (itime<0.6):
  2418.             chispas1=Bladex.GetEntity("Chispas1")
  2419.             chispas1.Position=blade.Position[0], blade.Position[1], blade.Position[2]+1500
  2420.             luzchispa1=Bladex.GetEntity("LuzChispa1")
  2421.             luzchispa1.Position=blade.Position[0]-200, blade.Position[1], blade.Position[2]+1500
  2422.     blade.Rotate(0.0,1.0,0.0,0.6-0.3*itime,1)
  2423.     if(itime>2.0):
  2424.         StopBlade(blade)
  2425.         #RBlades()
  2426.         RBlade1()
  2427.  
  2428. def LaunchBlade2():
  2429.     global b2_time
  2430.     Sonido_Cuchilla2_Activada.Play(-145250,-23124,-105000,0)
  2431.     b2_time=Bladex.GetTime()
  2432.     blade=Bladex.GetEntity("Blade2")
  2433.     blade.Position=-145250,-23124,-105000
  2434.     luzchispa2=Bladex.CreateEntity("LuzChispa2", "Entity Spot", blade.Position[0]+200, blade.Position[1], blade.Position[2]+1500)
  2435.     luzchispa2.Color=255, 140, 0
  2436.     luzchispa2.Intensity=1.5
  2437.     luzchispa2.Visible=0
  2438.     luzchispa2.CastShadows=0
  2439.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.6, ApagaLuzChispa,(luzchispa2,))
  2440.     chispas2=Bladex.CreateEntity("Chispas2", "Entity Particle System D1", blade.Position[0], blade.Position[1], blade.Position[2]+1500)
  2441.     chispas2.ParticleType="Spark"
  2442.     chispas2.YGravity=0.0
  2443.     chispas2.Friction=0.0
  2444.     chispas2.PPS=2048
  2445.     chispas2.Velocity=4000.0, 0.0, -4000.0
  2446.     chispas2.RandomVelocity=30.0
  2447.     chispas2.Time2Live=8
  2448.     chispas2.DeathTime=Bladex.GetTime()+0.6
  2449.     blade.Solid=0
  2450.     blade.MessageEvent(MESSAGE_START_WEAPON,0,0)
  2451.     blade.TimerFunc=Blade2TimerFunc
  2452.     blade.SubscribeToList("Timer60")
  2453.     Bladex.AddScheduledFunc(Bladex.GetTime()+1.0,RegetBlade1,())
  2454.     
  2455.  
  2456. def Blade2TimerFunc(blade_name,time):
  2457.     global b2_time
  2458.     itime=time-b2_time
  2459.     blade=Bladex.GetEntity(blade_name)
  2460.     blade.MessageEvent(MESSAGE_START_WEAPON,0,0)
  2461.     if(itime<1.0):
  2462.         blade.SetPosition(-145250+(6000.0-6000.0*itime)*itime,-23124,-105000+(16000.0-8000*itime)*itime,0)
  2463.         if (itime<0.6):
  2464.             chispas2=Bladex.GetEntity("Chispas2")
  2465.             chispas2.Position=blade.Position[0], blade.Position[1], blade.Position[2]+1500
  2466.             luzchispa2=Bladex.GetEntity("LuzChispa2")
  2467.             luzchispa2.Position=blade.Position[0]+200, blade.Position[1], blade.Position[2]+1500
  2468.     blade.Rotate(0.0,1.0,0.0,-0.6+0.3*itime,1)
  2469.     if(itime>2.0):
  2470.         StopBlade(blade)
  2471.         RBlade2()
  2472.     
  2473.  
  2474. def LaunchBlades():
  2475.     global blades_ready
  2476.     LaunchBlade2()
  2477.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.1,LaunchBlade1,())
  2478.     #slab.SlideTo(0,-200,0)
  2479.     blades_ready=0
  2480.  
  2481. def RBlades():
  2482.     global blades_ready
  2483.     blades_ready=1
  2484.     #if(blades_ready == 0):
  2485.     #    RBlade2()
  2486.     #    RBlade1()
  2487.         #slab.SlideTo(100,100,0)
  2488.  
  2489.  
  2490. def ActivateBlades(SectorIndex,EntyName):
  2491.     if(blades_ready):
  2492.         Sonido_TrampaCuchilla_Activada.Play(-141750,-23000,-99000,0)
  2493.         #lever.state == lever.LEVER_ON
  2494.         #lever.LeverOff()
  2495.         LaunchBlades()
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501. #*************************************************************************************************
  2502. #*************************************************************************************************
  2503. #*************************************************************************************************
  2504. #*******************************                                        **************************
  2505. #*******************************   Definiciones para Musica.py          **************************
  2506. #*******************************                                        **************************
  2507. #*************************************************************************************************
  2508. #*************************************************************************************************
  2509.  
  2510.  
  2511. def ApagaMusicaAlEntrar(trsector_name, entity_name):
  2512.     if entity_name=="Player1":
  2513.         Bladex.ExeMusicEvent(Bladex.GetMusicEvent("emptyloquesea"))
  2514.  
  2515. def EnciendeSuspenseRapido(trsector_name, entity_name):
  2516.     if entity_name=="Player1":
  2517.         Bladex.ExeMusicEvent(Bladex.GetMusicEvent("suspenserapido"))
  2518.  
  2519. def EnciendeMusicaCapilla(trsector_name, entity_name):
  2520.     if entity_name=="Player1":
  2521.         Bladex.ExeMusicEvent(Bladex.GetMusicEvent("musicacapilla"))
  2522.  
  2523. def DesactivaEnciendeMusicaCapilla(trsector_name, entity_name):
  2524.     if entity_name=="Player1":
  2525.         Bladex.RemoveTriggerSectorFunc("MusicaCapilla1", "OnEnter")
  2526.         Bladex.RemoveTriggerSectorFunc("MusicaCapilla2", "OnEnter")
  2527.  
  2528. def EnciendeSuspenseLento(trsector_name, entity_name):
  2529.     if entity_name=="Player1":
  2530.         Bladex.ExeMusicEvent(Bladex.GetMusicEvent("suspenselento"))
  2531.  
  2532. def EnciendeMusicaZonaCaos(trsector_name, entity_name):
  2533.     if entity_name=="Player1":
  2534.         if Bladex.GetEntity("ChaosK1").Life>=800:
  2535.             Bladex.ExeMusicEvent(Bladex.GetMusicEvent("musicazonacaos"))
  2536.         else:
  2537.             Bladex.ExeMusicEvent(Bladex.GetMusicEvent("suspenselento"))
  2538.  
  2539. def EnciendeMusicaTorre(trsector_name, entity_name):
  2540.     if entity_name=="Player1":
  2541.         Bladex.ExeMusicEvent(Bladex.GetMusicEvent("musicatorre"))
  2542.  
  2543. def EnciendeRagnarCuchillas(trsector_name, entity_name):
  2544.     if entity_name=="Player1":
  2545.         Bladex.ExeMusicEvent(Bladex.GetMusicEvent("ragnarcuchillas"))
  2546.         Bladex.RemoveTriggerSectorFunc("RagnarCuchillas", "OnEnter")
  2547.  
  2548. def EnciendeTrampa(trsector_name, entity_name):
  2549.     if entity_name=="Player1":
  2550.         Bladex.ExeMusicEvent(Bladex.GetMusicEvent("musicatrampa"))
  2551.         Bladex.RemoveTriggerSectorFunc(trsector_name, "OnEnter")
  2552.  
  2553. def EnciendeMusicaPendulos(trsector_name, entity_name):
  2554.     if entity_name=="Player1":
  2555.         Bladex.ExeMusicEvent(Bladex.GetMusicEvent("musicapendulos"))
  2556.